List of usage examples for com.fasterxml.jackson.databind.introspect Annotated getAnnotation
public abstract <A extends Annotation> A getAnnotation(Class<A> paramClass);
From source file:net.nullschool.grains.jackson.datatype.GrainsAnnotationIntrospector.java
/** * Returns the contents of the {@link PublicInterfaceRef} annotation on the specified annotated object, or null * if it does not exist./* w ww. jav a2s. co m*/ */ private static Class<?> publicInterfaceOf(Annotated annotated) { return Grain.class.isAssignableFrom(annotated.getRawType()) ? valueOf(annotated.getAnnotation(PublicInterfaceRef.class)) : null; }
From source file:com.addthis.codec.jackson.CodecIntrospector.java
@Override public PropertyName findNameForDeserialization(Annotated a) { FieldConfig fieldConfig = a.getAnnotation(FieldConfig.class); if ((fieldConfig != null) && !fieldConfig.writeonly() && fieldConfig.codable()) { return PropertyName.USE_DEFAULT; }//from ww w. j a v a 2 s .c o m return null; }
From source file:com.addthis.codec.jackson.CodecIntrospector.java
@Override public PropertyName findNameForSerialization(Annotated a) { FieldConfig fieldConfig = a.getAnnotation(FieldConfig.class); if ((fieldConfig != null) && !fieldConfig.readonly() && fieldConfig.codable()) { return PropertyName.USE_DEFAULT; }// ww w . ja v a 2 s .c o m return null; }
From source file:com.addthis.codec.jackson.CodecIntrospector.java
/** report all non-alias plugin types */ @Override// w ww .ja v a 2 s. co m public List<NamedType> findSubtypes(Annotated a) { Pluggable pluggable = a.getAnnotation(Pluggable.class); PluginMap pluginMap; if (pluggable != null) { pluginMap = pluginRegistry.byCategory().get(pluggable.value()); } else if (pluginRegistry.byClass().containsKey(a.getRawType())) { pluginMap = pluginRegistry.byClass().get(a.getRawType()); } else { return null; } List<NamedType> result = new ArrayList<>(pluginMap.asBiMap().size()); for (Map.Entry<String, Class<?>> type : pluginMap.asBiMap().entrySet()) { result.add(new NamedType(type.getValue(), type.getKey())); } return result; }
From source file:com.addthis.codec.jackson.CodecIntrospector.java
public TypeResolverBuilder<?> _findTypeResolver(MapperConfig<?> config, Annotated ac, JavaType baseType) { Pluggable pluggable = ac.getAnnotation(Pluggable.class); if (pluggable != null) { PluginMap pluginMap = pluginRegistry.byCategory().get(pluggable.value()); if (pluginMap != null) { return new CodecTypeResolverBuilder(pluginMap, config.getTypeFactory(), pluginRegistry); } else {/* ww w . ja v a2 s . c om*/ log.warn("missing plugin map for {}, reached from {}", pluggable.value(), ac.getRawType()); } } return null; }
From source file:com.google.api.server.spi.config.annotationreader.ApiAnnotationIntrospector.java
@Override public PropertyName findNameForSerialization(Annotated a) { ApiResourceProperty apiName = a.getAnnotation(ApiResourceProperty.class); if (apiName != null && apiName.ignored() != AnnotationBoolean.TRUE) { return PropertyName.construct(apiName.name()); }/* ww w . ja v a 2 s .c o m*/ return null; }
From source file:com.google.api.server.spi.config.annotationreader.ApiAnnotationIntrospector.java
@Override public PropertyName findNameForDeserialization(Annotated a) { ApiResourceProperty apiName = a.getAnnotation(ApiResourceProperty.class); if (apiName != null && apiName.ignored() != AnnotationBoolean.TRUE) { return PropertyName.construct(apiName.name()); }/*from w ww.jav a 2 s . co m*/ return null; }
From source file:org.usrz.libs.riak.introspection.RiakAnnotationIntrospector.java
@Override public PropertyName findNameForSerialization(Annotated a) { System.err.println("FindNameForSerialization " + a); if (a.hasAnnotation(RiakKey.class)) return NAME_KEY; if (a.hasAnnotation(RiakLink.class)) { final String tag = a.getAnnotation(RiakLink.class).value(); return NAME_LINKS_BASE.withSimpleName((!tag.isEmpty()) ? tag : (a instanceof AnnotatedField) ? a.getName() : (a instanceof AnnotatedMethod) ? okNameForGetter((AnnotatedMethod) a) : null); }//from w ww.ja v a2 s.c om if (a.hasAnnotation(RiakMetadata.class)) { final String field = a.getAnnotation(RiakMetadata.class).value(); return NAME_METADATA_BASE.withSimpleName((!field.isEmpty()) ? field : (a instanceof AnnotatedField) ? a.getName() : (a instanceof AnnotatedMethod) ? okNameForGetter((AnnotatedMethod) a) : null); } if (a.hasAnnotation(RiakIndex.class)) { final RiakIndex annotation = a.getAnnotation(RiakIndex.class); return propertyNameForIndex(annotation, a.getGenericType(), (!annotation.name().isEmpty()) ? annotation.name() : (!annotation.value().isEmpty()) ? annotation.value() : (a instanceof AnnotatedField) ? a.getName() : (a instanceof AnnotatedMethod) ? okNameForGetter((AnnotatedMethod) a) : null); } return null; }
From source file:org.usrz.libs.riak.introspection.RiakAnnotationIntrospector.java
@Override public PropertyName findNameForDeserialization(Annotated a) { System.err.println("FindNameForDeserialization " + a); if (a.hasAnnotation(RiakKey.class)) return NAME_KEY; if (a.hasAnnotation(RiakLink.class)) { final String tag = a.getAnnotation(RiakLink.class).value(); return NAME_LINKS_BASE.withSimpleName((!tag.isEmpty()) ? tag : (a instanceof AnnotatedField) ? a.getName() : (a instanceof AnnotatedMethod) ? okNameForGetter((AnnotatedMethod) a) : null); }// w ww . j a va 2 s . c om if (a.hasAnnotation(RiakMetadata.class)) { final String field = a.getAnnotation(RiakMetadata.class).value(); return NAME_METADATA_BASE.withSimpleName((!field.isEmpty()) ? field : (a instanceof AnnotatedField) ? a.getName() : (a instanceof AnnotatedMethod) ? okNameForGetter((AnnotatedMethod) a) : null); } if (a.hasAnnotation(RiakIndex.class)) { final RiakIndex annotation = a.getAnnotation(RiakIndex.class); final Type genericType = a instanceof AnnotatedField ? a.getGenericType() : a instanceof AnnotatedMethod ? ((AnnotatedMethod) a).getGenericParameterType(0) : null; return propertyNameForIndex(annotation, genericType, (!annotation.name().isEmpty()) ? annotation.name() : (!annotation.value().isEmpty()) ? annotation.value() : (a instanceof AnnotatedField) ? a.getName() : (a instanceof AnnotatedMethod) ? okNameForGetter((AnnotatedMethod) a) : null); } return null; }
From source file:io.swagger.v3.core.util.AnnotationsUtils.java
public static io.swagger.v3.oas.annotations.media.Schema getSchemaAnnotation(Annotated a) { if (a == null) { return null; }/*from w w w . j a v a2s. c om*/ io.swagger.v3.oas.annotations.media.ArraySchema arraySchema = a .getAnnotation(io.swagger.v3.oas.annotations.media.ArraySchema.class); if (arraySchema != null) { return arraySchema.schema(); } else { return a.getAnnotation(io.swagger.v3.oas.annotations.media.Schema.class); } }