Top Description Fields Constructors Methods
com.fasterxml.jackson.dataformat.avro

public Class AvroAnnotationIntrospector

extends AnnotationIntrospector
Class Inheritance
Imports
java.util.ArrayList, .Collections, .List, org.apache.avro.reflect.*, com.fasterxml.jackson.annotation.JsonCreator, .JsonTypeInfo, com.fasterxml.jackson.core.Version, com.fasterxml.jackson.databind.AnnotationIntrospector, .JavaType, .PropertyName, com.fasterxml.jackson.databind.cfg.MapperConfig, com.fasterxml.jackson.databind.introspect.Annotated, .AnnotatedClass, .AnnotatedConstructor, .AnnotatedMember, com.fasterxml.jackson.databind.jsontype.NamedType, .TypeResolverBuilder, com.fasterxml.jackson.databind.ser.std.ToStringSerializer, com.fasterxml.jackson.databind.util.ClassUtil, com.fasterxml.jackson.dataformat.avro.apacheimpl.CustomEncodingDeserializer, com.fasterxml.jackson.dataformat.avro.schema.AvroSchemaHelper, com.fasterxml.jackson.dataformat.avro.ser.CustomEncodingSerializer

Adds support for the following annotations from the Apache Avro implementation:
Since
2.9

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected PropertyName
protected TypeResolverBuilder<?>
protected Class<?>[]
public JsonCreator.Mode
findCreatorAnnotation(MapperConfig<?>
Configuration settings in effect (for serialization or deserialization)
config
,
Annotated
Annotated accessor (usually constructor or static method) to check
a
)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findCreatorAnnotation.

Method called to check whether potential Creator (constructor or static factory method) has explicit annotation to indicate it as actual Creator; and if so, which com.fasterxml.jackson.annotation.JsonCreator.Mode to use.

public Object
findDeserializer(Annotated am)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findDeserializer.

Method for getting a deserializer definition on specified method or field.

public PropertyName
findNameForDeserialization(Annotated
Annotated entity to check
a
)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findNameForDeserialization.

Method for checking whether given property accessors (method, field) has an annotation that suggests property name to use for deserialization (reading JSON into POJOs).

public PropertyName
findNameForSerialization(Annotated
Property accessor to check
a
)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findNameForSerialization.

Method for checking whether given property accessors (method, field) has an annotation that suggests property name to use for serialization.

public List<PropertyName>
findPropertyAliases(Annotated m)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyAliases.

Method called to find if given property has alias(es) defined.

public TypeResolverBuilder<?>
findPropertyContentTypeResolver(MapperConfig<?>
Configuration settings in effect (for serialization or deserialization)
config
,
AnnotatedMember
Annotated member (field or method) to check for annotations
am
,
JavaType
Type of property for which resolver is to be found (must be a container type)
containerType
)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyContentTypeResolver.

Method for checking if given structured property entity (field or method that has nominal value of Map, Collection or array type) has annotations that indicate that specific type resolver is to be used for handling type information of contained values.

public String
findPropertyDefaultValue(Annotated m)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyDefaultValue.

Method for finding suggested default value (as simple textual serialization) for the property.

public TypeResolverBuilder<?>
findPropertyTypeResolver(MapperConfig<?>
Configuration settings in effect (for serialization or deserialization)
config
,
AnnotatedMember
Annotated member (field or method) to check for annotations
am
,
JavaType
Base java type of property for which resolver is to be found
baseType
)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyTypeResolver.

Method for checking if given property entity (field or method) has annotations that indicate that specific type resolver is to be used for handling instances.

public Object
findSerializer(Annotated a)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findSerializer.

Method for getting a serializer definition on specified method or field.

public List<NamedType>
findSubtypes(Annotated
Annotated entity (class, field/method) to check for annotations
a
)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findSubtypes.

Method for locating annotation-specified subtypes related to annotated entity (class, method, field).

public TypeResolverBuilder<?>
findTypeResolver(MapperConfig<?>
Configuration settings in effect (for serialization or deserialization)
config
,
AnnotatedClass
Annotated class to check for annotations
ac
,
JavaType
Base java type of value for which resolver is to be found
baseType
)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findTypeResolver.

Method for checking if given class has annotations that indicate that specific type resolver is to be used for handling instances.

public boolean
hasIgnoreMarker(AnnotatedMember m)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.hasIgnoreMarker.

Method called to check whether given property is marked to be ignored.

public Boolean
hasRequiredMarker(AnnotatedMember m)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.hasRequiredMarker.

Method that can be called to check whether this member has an annotation that suggests whether value for matching property is required or not.

public Version
version()

Implements abstract com.fasterxml.jackson.databind.AnnotationIntrospector.version.

Implements com.fasterxml.jackson.core.Versioned.version.

Method called to detect version of the component that implements this interface; returned version should never be null, but may return specific "not available" instance (see Version for details).

Inherited from com.fasterxml.jackson.databind.AnnotationIntrospector:
_findAnnotation_hasAnnotation_hasOneOfallIntrospectorsallIntrospectorsfindAndAddVirtualPropertiesfindAutoDetectVisibilityfindClassDescriptionfindContentDeserializerfindContentSerializerfindCreatorBindingfindDefaultEnumValuefindDefaultEnumValuefindDeserializationContentConverterfindDeserializationConverterfindEnumAliasesfindEnumAliasesfindEnumNamingStrategyfindEnumValuefindEnumValuesfindEnumValuesfindFilterIdfindFormatfindIgnoreUnknownPropertiesfindImplicitPropertyNamefindInjectableValuefindInjectableValueIdfindKeyDeserializerfindKeySerializerfindMergeInfofindNamingStrategyfindNullSerializerfindObjectIdInfofindObjectReferenceInfofindPOJOBuilderfindPOJOBuilderConfigfindPolymorphicTypeInfofindPropertiesToIgnorefindPropertyAccessfindPropertyDescriptionfindPropertyIgnoralByNamefindPropertyIgnoralsfindPropertyInclusionfindPropertyInclusionByNamefindPropertyIndexfindReferenceTypefindRenameByFieldfindRootNamefindSerializationContentConverterfindSerializationConverterfindSerializationPropertyOrderfindSerializationSortAlphabeticallyfindSerializationTypingfindSetterInfofindTypeNamefindUnwrappingNameTransformerfindValueInstantiatorfindViewsfindWrapperNamehasAnyGetterhasAnyGetterAnnotationhasAnySetterhasAnySetterAnnotationhasAsKeyhasAsValuehasAsValueAnnotationhasCreatorAnnotationisAnnotationBundleisIgnorableTypeisTypeIdnopInstancepairrefineDeserializationTyperefineSerializationTyperesolveSetterConflict

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

AvroAnnotationIntrospectorback to summary
public AvroAnnotationIntrospector()

Method Detail

_findNameback to summary
protected PropertyName _findName(Annotated a)
_findTypeResolverback to summary
protected TypeResolverBuilder<?> _findTypeResolver(MapperConfig<?> config, Annotated ann, JavaType baseType)
_getUnionTypesback to summary
protected Class<?>[] _getUnionTypes(Annotated a)
findCreatorAnnotationback to summary
public JsonCreator.Mode findCreatorAnnotation(MapperConfig<?> config, Annotated a)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findCreatorAnnotation.

Doc from com.fasterxml.jackson.databind.AnnotationIntrospector.findCreatorAnnotation.

Method called to check whether potential Creator (constructor or static factory method) has explicit annotation to indicate it as actual Creator; and if so, which com.fasterxml.jackson.annotation.JsonCreator.Mode to use.

Note

caller needs to consider possibility of both `null` (no annotation found) and com.fasterxml.jackson.annotation.JsonCreator.Mode#DISABLED (annotation found, but disabled); latter is necessary as marker in case multiple introspectors are chained, as well as possibly as when using mix-in annotations.

Parameters
config:MapperConfig<?>

Configuration settings in effect (for serialization or deserialization)

a:Annotated

Annotated accessor (usually constructor or static method) to check

Returns:JsonCreator.Mode

Creator mode found, if any; null if none

Annotations
@Override
findDeserializerback to summary
public Object findDeserializer(Annotated am)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findDeserializer.

Doc from com.fasterxml.jackson.databind.AnnotationIntrospector.findDeserializer.

Method for getting a deserializer definition on specified method or field. Type of definition is either instance (of type JsonDeserializer) or Class (of type Class&<JsonDeserializer>); type is returned, a runtime exception may be thrown by caller.

Annotations
@Override
findNameForDeserializationback to summary
public PropertyName findNameForDeserialization(Annotated a)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findNameForDeserialization.

Doc from com.fasterxml.jackson.databind.AnnotationIntrospector.findNameForDeserialization.

Method for checking whether given property accessors (method, field) has an annotation that suggests property name to use for deserialization (reading JSON into POJOs). Should return null if no annotation is found; otherwise a non-null name (possibly PropertyName#USE_DEFAULT, which means "use default heuristics").

Parameters
a:Annotated

Annotated entity to check

Returns:PropertyName

Name to use if found; null if not.

Annotations
@Override
findNameForSerializationback to summary
public PropertyName findNameForSerialization(Annotated a)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findNameForSerialization.

Doc from com.fasterxml.jackson.databind.AnnotationIntrospector.findNameForSerialization.

Method for checking whether given property accessors (method, field) has an annotation that suggests property name to use for serialization. Should return null if no annotation is found; otherwise a non-null name (possibly PropertyName#USE_DEFAULT, which means "use default heuristics").

Parameters
a:Annotated

Property accessor to check

Returns:PropertyName

Name to use if found; null if not.

Annotations
@Override
findPropertyAliasesback to summary
public List<PropertyName> findPropertyAliases(Annotated m)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyAliases.

Doc from com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyAliases.

Method called to find if given property has alias(es) defined.

Returns:List<PropertyName>

`null` if member has no information; otherwise a `List` (possibly empty) of aliases to use.

Annotations
@Override
findPropertyContentTypeResolverback to summary
public TypeResolverBuilder<?> findPropertyContentTypeResolver(MapperConfig<?> config, AnnotatedMember am, JavaType containerType)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyContentTypeResolver.

Doc from com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyContentTypeResolver.

Method for checking if given structured property entity (field or method that has nominal value of Map, Collection or array type) has annotations that indicate that specific type resolver is to be used for handling type information of contained values. This includes not only instantiating resolver builder, but also configuring it based on relevant annotations (not including ones checked with a call to findSubtypes

Parameters
config:MapperConfig<?>

Configuration settings in effect (for serialization or deserialization)

am:AnnotatedMember

Annotated member (field or method) to check for annotations

containerType:JavaType

Type of property for which resolver is to be found (must be a container type)

Returns:TypeResolverBuilder<?>

Type resolver builder for values contained in properties of given entity, if one found; null if none

Annotations
@Override
findPropertyDefaultValueback to summary
public String findPropertyDefaultValue(Annotated m)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyDefaultValue.

Doc from com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyDefaultValue.

Method for finding suggested default value (as simple textual serialization) for the property. While core databind does not make any use of it, it is exposed for extension modules to use: an expected use is generation of schema representations and documentation.

Annotations
@Override
findPropertyTypeResolverback to summary
public TypeResolverBuilder<?> findPropertyTypeResolver(MapperConfig<?> config, AnnotatedMember am, JavaType baseType)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyTypeResolver.

Doc from com.fasterxml.jackson.databind.AnnotationIntrospector.findPropertyTypeResolver.

Method for checking if given property entity (field or method) has annotations that indicate that specific type resolver is to be used for handling instances. This includes not only instantiating resolver builder, but also configuring it based on relevant annotations (not including ones checked with a call to findSubtypes

Parameters
config:MapperConfig<?>

Configuration settings in effect (for serialization or deserialization)

am:AnnotatedMember

Annotated member (field or method) to check for annotations

baseType:JavaType

Base java type of property for which resolver is to be found

Returns:TypeResolverBuilder<?>

Type resolver builder for properties of given entity, if one found; null if none

Annotations
@Override
findSerializerback to summary
public Object findSerializer(Annotated a)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findSerializer.

Doc from com.fasterxml.jackson.databind.AnnotationIntrospector.findSerializer.

Method for getting a serializer definition on specified method or field. Type of definition is either instance (of type JsonSerializer) or Class (of Class<JsonSerializer> implementation subtype); if value of different type is returned, a runtime exception may be thrown by caller.

Annotations
@Override
findSubtypesback to summary
public List<NamedType> findSubtypes(Annotated a)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findSubtypes.

Doc from com.fasterxml.jackson.databind.AnnotationIntrospector.findSubtypes.

Method for locating annotation-specified subtypes related to annotated entity (class, method, field). Note that this is only guaranteed to be a list of directly declared subtypes, no recursive processing is guarantees (i.e. caller has to do it if/as necessary)

Parameters
a:Annotated

Annotated entity (class, field/method) to check for annotations

Returns:List<NamedType>

List of subtype definitions found if any; null if none

Annotations
@Override
findTypeResolverback to summary
public TypeResolverBuilder<?> findTypeResolver(MapperConfig<?> config, AnnotatedClass ac, JavaType baseType)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.findTypeResolver.

Doc from com.fasterxml.jackson.databind.AnnotationIntrospector.findTypeResolver.

Method for checking if given class has annotations that indicate that specific type resolver is to be used for handling instances. This includes not only instantiating resolver builder, but also configuring it based on relevant annotations (not including ones checked with a call to findSubtypes

Parameters
config:MapperConfig<?>

Configuration settings in effect (for serialization or deserialization)

ac:AnnotatedClass

Annotated class to check for annotations

baseType:JavaType

Base java type of value for which resolver is to be found

Returns:TypeResolverBuilder<?>

Type resolver builder for given type, if one found; null if none

Annotations
@Override
hasIgnoreMarkerback to summary
public boolean hasIgnoreMarker(AnnotatedMember m)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.hasIgnoreMarker.

Doc from com.fasterxml.jackson.databind.AnnotationIntrospector.hasIgnoreMarker.

Method called to check whether given property is marked to be ignored. This is used to determine whether to ignore properties, on per-property basis, usually combining annotations from multiple accessors (getters, setters, fields, constructor parameters).

Annotations
@Override
hasRequiredMarkerback to summary
public Boolean hasRequiredMarker(AnnotatedMember m)

Overrides com.fasterxml.jackson.databind.AnnotationIntrospector.hasRequiredMarker.

Doc from com.fasterxml.jackson.databind.AnnotationIntrospector.hasRequiredMarker.

Method that can be called to check whether this member has an annotation that suggests whether value for matching property is required or not.

Annotations
@Override
versionback to summary
public Version version()

Implements abstract com.fasterxml.jackson.databind.AnnotationIntrospector.version.

Implements com.fasterxml.jackson.core.Versioned.version.

Doc from com.fasterxml.jackson.core.Versioned.version.

Method called to detect version of the component that implements this interface; returned version should never be null, but may return specific "not available" instance (see Version for details).

Returns:Version

Version of the component

Annotations
@Override