Top Description Inners Constructors Methods
tools.jackson.databind

public abstract Class AnnotationIntrospector

extends Object
implements Versioned, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, tools.jackson.core.Versioned
Known Direct Subclasses
tools.jackson.databind.introspect.AnnotationIntrospectorPair, tools.jackson.databind.introspect.JacksonAnnotationIntrospector, tools.jackson.databind.introspect.NopAnnotationIntrospector
Annotations
@SuppressWarnings:serial
Imports
java.lang.annotation.Annotation, java.util.*, com.fasterxml.jackson.annotation.*, tools.jackson.core.Version, .Versioned, tools.jackson.databind.annotation.JsonPOJOBuilder, .JsonSerialize, tools.jackson.databind.cfg.MapperConfig, tools.jackson.databind.deser.ValueInstantiator, tools.jackson.databind.introspect.*, tools.jackson.databind.jsontype.NamedType, tools.jackson.databind.ser.BeanPropertyWriter, tools.jackson.databind.util.Converter, .NameTransformer

Abstract class that defines API used for introspecting annotation-based configuration for serialization and deserialization. Separated so that different sets of annotations can be supported, and support plugged-in dynamically.

Although default implementations are based on using annotations as the only (or at least main) information source, custom implementations are not limited in such a way, and in fact there is no expectation they should be. So the name is bit of misnomer; this is a general configuration introspection facility.

Note

due to rapid addition of new methods (and changes to existing methods), it is strongly recommended that custom implementations should not directly extend this class, but rather extend NopAnnotationIntrospector. This way added methods will not break backwards compatibility of custom annotation introspectors.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
AnnotationIntrospector.ReferenceProperty

Value type used with managed and back references; contains type and logic name, used to link related references

public static interface
AnnotationIntrospector.XmlExtensions

Add-on extension used for XML-specific configuration, needed to decouple format module functionality from pluggable introspection functionality (especially JAXB-annotation related one).

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected <A extends Annotation> A

Returns:

Value of given annotation (as per annoClass), if entity has one; null otherwise
_findAnnotation
(Annotated
Annotated entity to check for specified annotation
ann
,
Class<A>
Type of annotation to find
annoClass
)

Method that should be used by sub-classes for ALL annotation access; overridable so that sub-classes may, if they choose to, mangle actual access to block access ("hide" annotations) or perhaps change it.

protected boolean

Returns:

true if specified annotation exists in given entity; false if not
_hasAnnotation
(Annotated
Annotated entity to check for specified annotation
ann
,
Class<? extends Annotation>
Type of annotation to find
annoClass
)

Method that should be used by sub-classes for ALL annotation existence access; overridable so that sub-classes may, if they choose to, mangle actual access to block access ("hide" annotations) or perhaps change value seen.

protected boolean

Returns:

true if at least one of specified annotation exists in given entity; false otherwise
_hasOneOf
(Annotated
Annotated entity to check for specified annotation
ann
,
Class<? extends Annotation>[]
Types of annotation to find
annoClasses
)

Alternative lookup method that is used to see if annotation has at least one of annotations of types listed in second argument.

public Collection<AnnotationIntrospector>

Returns:

Collection of all introspectors starting with this one, in case multiple introspectors are chained
allIntrospectors
()

Method that can be used to collect all "real" introspectors that this introspector contains, if any; or this introspector if it is not a container.

public Collection<AnnotationIntrospector>

Returns:

Passed in Collection filled with introspectors as explained above
allIntrospectors
(Collection<AnnotationIntrospector>
Container to add introspectors to
result
)

Method that can be used to collect all "real" introspectors that this introspector contains, if any; or this introspector if it is not a container.

public void
findAndAddVirtualProperties(MapperConfig<?> config, AnnotatedClass ac, List<BeanPropertyWriter> properties)

Method for adding possible virtual properties to be serialized along with regular properties.

public VisibilityChecker
findAutoDetectVisibility(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedClass
Annotated class to introspect
ac
,
VisibilityChecker checker)

Method for checking if annotations indicate changes to minimum visibility levels needed for auto-detecting property elements (fields, methods, constructors).

public String

Returns:

Human-readable description, if any.
findClassDescription
(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedClass
Annotated class to introspect
ac
)

Method used to check whether specified class defines a human-readable description to use for documentation.

public Object
findContentDeserializer(MapperConfig<?> config, Annotated am)

Method for getting a deserializer definition for content (values) of associated Collection, array or Map property.

public Object
findContentSerializer(MapperConfig<?> config, Annotated am)

Method for getting a serializer definition for content (values) of associated Collection, array or Map property.

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
)

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 Enum<?>

Returns:

null if none found or it's not possible to determine one.
findDefaultEnumValue
(MapperConfig<?> config, AnnotatedClass
The Enum class to scan for the default value.
ac
,
Enum<?>[]
The Enum values of the Enum class.
enumValues
)

Finds the first Enum value that should be considered as default value for unknown Enum values, if present.

public Object
findDeserializationContentConverter(MapperConfig<?> config, AnnotatedMember
Annotated property (field, method) to check.
a
)

Method for finding Converter that annotated property has indicated needs to be used for values of container type (this also means that method should only be called for properties of container types, List/Map/array properties).

public Object
findDeserializationConverter(MapperConfig<?> config, Annotated
Annotated property (field, method) or class to check for annotations
a
)

Method for finding Converter that annotated entity (property or class) has indicated to be used as part of deserialization.

public Object
findDeserializer(MapperConfig<?> config, Annotated am)

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

public void
findEnumAliases(MapperConfig<?>
The configuration of the mapper
config
,
AnnotatedClass
The annotated class of the enumeration type
annotatedClass
,
Enum<?>[]
The values of the enumeration
enumValues
,
String[][]
(in/out) Pre-allocated array where aliases found, if any, may be added (in indexes matching those of enumValues)
aliases
)

Method that is called to check if there are alternative names (aliases) that can be accepted for entries in addition to primary names that were introspected earlier, related to findEnumValues.

public Object

Returns:

Subclass or instance of EnumNamingStrategy, if one is specified for given class; null if not.
findEnumNamingStrategy
(MapperConfig<?> config, AnnotatedClass
Annotated class to introspect
ac
)

Method for finding EnumNamingStrategy for given class, if any specified by annotations; and if so, either return a EnumNamingStrategy instance, or Class to use for creating instance

public String[]

Returns:

an array of names to use (possibly names passed as argument)
findEnumValues
(MapperConfig<?>
the mapper configuration to use
config
,
AnnotatedClass
the annotated class for which to find the explicit names
annotatedClass
,
Enum<?>[]
the set of Enum values to find the explicit names for
enumValues
,
String[]
the matching declared names of enumeration values (with indexes matching enumValues entries)
names
)

Finds the explicitly defined name of the given set of Enum values, if any.

public Object

Returns:

Id of the filter to use for filtering properties of annotated class, if any; or null if none found.
findFilterId
(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated
Annotated entity to introspect
ann
)

Method for finding if annotated class has associated filter; and if so, to return id that is used to locate filter.

public JsonFormat.Value
findFormat(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated memberOrClass)

Method for finding format annotations for property or class.

public String
findImplicitPropertyName(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedMember member)

Method for finding implicit name for a property that given annotated member (field, method, creator parameter) may represent.

public JacksonInject.Value

Returns:

Identifier of value to inject, if any; null if no injection indicator is found
findInjectableValue
(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedMember
Member to check for information
member
)

Method called to find out whether given member expectes a value to be injected, and if so, what is the identifier of the value to use during injection.

public Object
findKeyDeserializer(MapperConfig<?> config, Annotated am)

Method for getting a deserializer definition for keys of associated Map property.

public Object
findKeySerializer(MapperConfig<?> config, Annotated am)

Method for getting a serializer definition for keys of associated java.util.Map property.

public Boolean
findMergeInfo(MapperConfig<?> config, Annotated a)

Method for finding merge settings for property, if any.

public PropertyName

Returns:

Name to use if found; null if not.
findNameForDeserialization
(MapperConfig<?> config, Annotated
Annotated entity to check
ann
)

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

Returns:

Name to use if found; null if not.
findNameForSerialization
(MapperConfig<?> config, Annotated
Property accessor to check
a
)

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

public Object

Returns:

Sub-class or instance of PropertyNamingStrategy, if one is specified for given class; null if not.
findNamingStrategy
(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedClass
Annotated class to introspect
ac
)

Method for finding PropertyNamingStrategy for given class, if any specified by annotations; and if so, either return a PropertyNamingStrategy instance, or Class to use for creating instance

public Object
findNullSerializer(MapperConfig<?> config, Annotated am)

Method for getting a serializer definition for serializer to use for nulls (null values) of associated property or type.

public ObjectIdInfo

Returns:

Details of Object Id as explained above, if Object Id handling to be applied; null otherwise.
findObjectIdInfo
(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated
Annotated entity to introspect
ann
)

Method for checking whether given annotated thing (type, or accessor) indicates that values referenced (values of type of annotated class, or values referenced by annotated property; latter having precedence) should include Object Identifier, and if so, specify details of Object Identity used.

public ObjectIdInfo

Returns:

ObjectIdInfo augmented with possible additional information
findObjectReferenceInfo
(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated
Annotated entity to introspect
ann
,
ObjectIdInfo
(optional) Base Object Id information, if any; null if none
objectIdInfo
)

Method for figuring out additional properties of an Object Identity reference

public Class<?>
findPOJOBuilder(MapperConfig<?> config, AnnotatedClass
Annotated class to introspect
ac
)

Method for finding Builder object to use for constructing value instance and binding data (sort of combining value instantiators that can construct, and deserializers that can bind data).

public JsonPOJOBuilder.Value
findPOJOBuilderConfig(MapperConfig<?> config, AnnotatedClass
Annotated class to introspect
ac
)

public JsonTypeInfo.Value
findPolymorphicTypeInfo(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated
Annotated entity to introspect
ann
)

Method for checking whether given Class or Property Accessor specifies polymorphic type-handling information, to indicate need for polymorphic handling.

public PotentialCreator

Returns:

Default Creator to possibly use for valueClass, if one can be determined; null if not.
findPreferredCreator
(MapperConfig<?>
Configuration settings in effect (for deserialization)
config
,
AnnotatedClass
Class being instantiated; defines Creators passed
valueClass
,
List<PotentialCreator>
Constructors value class declares (EXCEPT possible 0-parameter ("default") constructor which is passed separately)
declaredConstructors
,
List<PotentialCreator>
Factory methods value class declares
declaredFactories
,
Optional<PotentialCreator>
0-parameter ("default") constructor, if class has one.
zeroParamsConstructor
)

Method called to check if introspector can find a Creator it considers its "Preferred Creator": Creator to use as the primary one, when no Creator has explicit annotation (findCreatorAnnotation returns null).

public JsonProperty.Access
findPropertyAccess(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated ann)

Method for finding optional access definition for a property, annotated on one of its accessors.

public List<PropertyName>

Returns:

`null` if member has no information; otherwise a `List` (possibly empty) of aliases to use.
findPropertyAliases
(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated ann)

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

public String
findPropertyDefaultValue(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated ann)

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

public String

Returns:

Human-readable description, if any.
findPropertyDescription
(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated ann)

Method used to check whether specified property member (accessor or mutator) defines human-readable description to use for documentation.

public JsonIgnoreProperties.Value
findPropertyIgnoralByName(MapperConfig<?>
Configuration settings in effect (for serialization or deserialization)
config
,
Annotated
Annotated entity (Class, Accessor) to introspect
ann
)

Method for finding information about properties to ignore either by name, or by more general specification ("ignore all unknown").

public JsonInclude.Value
findPropertyInclusion(MapperConfig<?> config, Annotated a)

Method for checking inclusion criteria for a type (Class) or property (yes, method name is bit unfortunate -- not just for properties!).

public JsonIncludeProperties.Value
findPropertyInclusionByName(MapperConfig<?>
Configuration settings in effect (for serialization or deserialization)
config
,
Annotated
Annotated entity (Class, Accessor) to introspect
ann
)

Method for finding information about names of properties to included.

public Integer

Returns:

Explicitly specified index for the property, if any
findPropertyIndex
(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated ann)

Method used to check whether specified property member (accessor or mutator) defines numeric index, and if so, what is the index value.

public AnnotationIntrospector.ReferenceProperty
findReferenceType(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedMember
Member to check for information
member
)

Method for checking if given member indicates that it is part of a reference (parent/child).

public PropertyName

Returns:

Name used to find other accessors to rename, if any; null to indicate no renaming
findRenameByField
(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedField
Field to check
f
,
PropertyName
Implicit name of the field; usually name of field itself but not always, used as the target name for accessors to rename.
implName
)

Method called on fields that are eligible candidates for properties (that is, non-static member fields), but not necessarily selected (may or may not be visible), to let fields affect name linking.

public PropertyName
findRootName(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedClass
Annotated class to introspect
ac
)

Method for locating name used as "root name" (for use by some serializers when outputting root-level object -- mostly for XML compatibility purposes) for given class, if one is defined.

public Object
findSerializationContentConverter(MapperConfig<?> config, AnnotatedMember
Annotated property (field, method) to check.
a
)

Method for finding Converter that annotated property has indicated needs to be used for values of container type (this also means that method should only be called for properties of container types, List/Map/array properties).

public Object
findSerializationConverter(MapperConfig<?> config, Annotated
Annotated property (field, method) or class to check for annotations
a
)

Method for finding Converter that annotated entity (property or class) has indicated to be used as part of serialization.

public String[]
findSerializationPropertyOrder(MapperConfig<?> config, AnnotatedClass ac)

Method for accessing defined property serialization order (which may be partial).

public Boolean
findSerializationSortAlphabetically(MapperConfig<?> config, Annotated ann)

Method for checking whether an annotation indicates that serialized properties for which no explicit is defined should be alphabetically (lexicograpically) ordered

public JsonSerialize.Typing

Returns:

Typing mode to use, if annotation is found; null otherwise
findSerializationTyping
(MapperConfig<?> config, Annotated a)

Method for accessing declared typing mode annotated (if any).

public Object
findSerializer(MapperConfig<?> config, Annotated am)

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

public JsonSetter.Value
findSetterInfo(MapperConfig<?> config, Annotated a)

Method for finding possible settings for property, given annotations on an accessor.

public List<NamedType>
findSubtypes(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated
Annotated entity (class, field/method) to check for annotations
a
)

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

public Object
findTypeIdResolver(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated
Annotated entity to introspect
ann
)

public String
findTypeName(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedClass
Class to check for type name annotations
ac
)

Method for checking if specified type has explicit name.

public Object
findTypeResolverBuilder(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated
Annotated entity to introspect
ann
)

public NameTransformer
findUnwrappingNameTransformer(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedMember
Member to check for information
member
)

Method called to check whether given property is marked to be "unwrapped" when being serialized (and appropriately handled in reverse direction, i.e. expect unwrapped representation during deserialization).

public Object
findValueInstantiator(MapperConfig<?> config, AnnotatedClass
Annotated class to introspect
ac
)

Method getting ValueInstantiator to use for given type (class): return value can either be an instance of instantiator, or class of instantiator to create.

public Class<?>[]

Returns:

Array of views (represented by classes) that the property is included in; if null, always included (same as returning array containing Object.class)
findViews
(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated
Annotated property (represented by a method, field or ctor parameter)
a
)

Method for checking if annotated property (represented by a field or getter/setter method) has definitions for views it is to be included in. If null is returned, no view definitions exist and property is always included (or always excluded as per default view inclusion configuration); otherwise it will only be included for views included in returned array.

public PropertyName

Returns:

Wrapper name to use, if any, or PropertyName#USE_DEFAULT to indicate that no wrapper element should be used.
findWrapperName
(MapperConfig<?>
Effective mapper configuration in use
config
,
Annotated ann)

Method used to check if specified property has annotation that indicates that it should be wrapped in an element; and if so, name to use.

public Boolean

Returns:

True if such annotation is found (and is not disabled), false otherwise
hasAnyGetter
(MapperConfig<?> config, Annotated
Annotated entity to check
ann
)

Method for checking whether given method has an annotation that suggests that the method is to serve as "any setter"; method to be used for accessing set of miscellaneous "extra" properties, often bound with matching "any setter" method.

public Boolean

Returns:

True if such annotation is found (and is not disabled), false otherwise
hasAnySetter
(MapperConfig<?> config, Annotated
Annotated entity to check
ann
)

Method for checking whether given method has an annotation that suggests that the method is to serve as "any setter"; method to be used for setting values of any properties for which no dedicated setter method is found.

public Boolean

Returns:

Boolean#TRUE if such annotation is found and is not disabled; Boolean#FALSE if disabled annotation (block) is found (to indicate accessor is definitely NOT to be used "as value"); or `null` if no information found.
hasAsKey
(MapperConfig<?> config, Annotated a)

Method for checking whether given method has an annotation that suggests the return value of annotated field or method should be used as "the key" of the object instance; usually serialized as a primitive value such as String or number.

public Boolean

Returns:

Boolean#TRUE if such annotation is found and is not disabled; Boolean#FALSE if disabled annotation (block) is found (to indicate accessor is definitely NOT to be used "as value"); or `null` if no information found.
hasAsValue
(MapperConfig<?> config, Annotated a)

Method for checking whether given method has an annotation that suggests that the return value of annotated method should be used as "the value" of the object instance; usually serialized as a primitive value such as String or number.

public boolean
hasIgnoreMarker(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedMember
Member to check for information
member
)

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

public Boolean
hasRequiredMarker(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedMember
Member to check for information
member
)

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 boolean

Returns:

True if given annotation is considered an annotation bundle; false if not
isAnnotationBundle
(Annotation
Annotated entity to introspect
ann
)

Method for checking whether given annotation is considered an annotation bundle: if so, all meta-annotations it has will be used instead of annotation ("bundle") itself.

public Boolean

Returns:

Boolean.TRUE if properties of type should be ignored; Boolean.FALSE if they are not to be ignored, null for default handling (which is 'do not ignore')
isIgnorableType
(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedClass
Annotated class to introspect
ac
)

Method for checking whether properties that have specified type (class, not generics aware) should be completely ignored for serialization and deserialization purposes.

public Boolean
isTypeId(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedMember
Member to check for type id information
member
)

Method for checking whether given accessor claims to represent type id: if so, its value may be used as an override, instead of generated type id.

public static AnnotationIntrospector

Returns:

"no operation" instance
nopInstance
()

Factory method for accessing "no operation" implementation of introspector: instance that will never find any annotation-based configuration.

public static AnnotationIntrospector
public JavaType
refineDeserializationType(MapperConfig<?> config, final Annotated a, final JavaType baseType)

Method called to find out possible type refinements to use for deserialization.

public JavaType
refineSerializationType(final MapperConfig<?> config, final Annotated a, final JavaType baseType)

Method called to find out possible type refinements to use for deserialization, including not just value itself but key and/or content type, if type has those.

public AnnotatedMethod
resolveSetterConflict(MapperConfig<?>
Effective mapper configuration in use
config
,
AnnotatedMethod setter1, AnnotatedMethod setter2)

Method called in cases where a class has two methods eligible to be used for the same logical property, and default logic is not enough to figure out clear precedence.

public abstract Version
version()

Redeclares tools.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 java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait