Class JacksonAnnotationIntrospector
- All Implemented Interfaces:
Serializable,Versioned
AnnotationIntrospector implementation that handles standard
Jackson annotations.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.databind.AnnotationIntrospector
AnnotationIntrospector.ReferenceProperty, AnnotationIntrospector.XmlExtensions -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LookupCache<String,Boolean> Since introspection of annotation types is a performance issue in some use cases (rare, but do exist), let's try a simple cache to reduce need for actual meta-annotation introspection.protected booleanSeesetConstructorPropertiesImpliesCreator(boolean)for explanation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<?>_classIfExplicit(Class<?> cls) protected Class<?>_classIfExplicit(Class<?> cls, Class<?> implicit) protected BeanPropertyWriter_constructVirtualProperty(JsonAppend.Attr attr, MapperConfig<?> config, AnnotatedClass ac, JavaType type) protected BeanPropertyWriter_constructVirtualProperty(JsonAppend.Prop prop, MapperConfig<?> config, AnnotatedClass ac) protected String_findImplicitName(AnnotatedWithParams m, int index) protected booleanprotected PropertyName_propertyName(String localName, String namespace) voidfindAndAddVirtualProperties(MapperConfig<?> config, AnnotatedClass ac, List<BeanPropertyWriter> properties) Method for adding possible virtual properties to be serialized along with regular properties.findAutoDetectVisibility(MapperConfig<?> config, AnnotatedClass ac, VisibilityChecker checker) Method for checking if annotations indicate changes to minimum visibility levels needed for auto-detecting property elements (fields, methods, constructors).findClassDescription(MapperConfig<?> config, AnnotatedClass ac) Method used to check whether specified class defines a human-readable description to use for documentation.findContentDeserializer(MapperConfig<?> config, Annotated a) Method for getting a deserializer definition for content (values) of associatedCollection,arrayorMapproperty.findContentSerializer(MapperConfig<?> config, Annotated a) Method for getting a serializer definition for content (values) of associatedCollection,arrayorMapproperty.findCreatorAnnotation(MapperConfig<?> config, Annotated 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, whichJsonCreator.Modeto use.Enum<?>findDefaultEnumValue(MapperConfig<?> config, AnnotatedClass annotatedClass, Enum<?>[] enumValues) Finds the Enum value that should be considered the default value, if possible.findDeserializationContentConverter(MapperConfig<?> config, AnnotatedMember a) Method for findingConverterthat 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).findDeserializationConverter(MapperConfig<?> config, Annotated a) Method for findingConverterthat annotated entity (property or class) has indicated to be used as part of deserialization.findDeserializer(MapperConfig<?> config, Annotated a) Method for getting a deserializer definition on specified method or field.voidfindEnumAliases(MapperConfig<?> config, AnnotatedClass annotatedClass, Enum<?>[] enumValues, String[][] aliasList) 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 toAnnotationIntrospector.findEnumValues(tools.jackson.databind.cfg.MapperConfig<?>, tools.jackson.databind.introspect.AnnotatedClass, java.lang.Enum<?>[], java.lang.String[]).findEnumNamingStrategy(MapperConfig<?> config, AnnotatedClass ac) Method for findingEnumNamingStrategyfor given class, if any specified by annotations; and if so, either return aEnumNamingStrategyinstance, or Class to use for creating instanceString[]findEnumValues(MapperConfig<?> config, AnnotatedClass annotatedClass, Enum<?>[] enumValues, String[] names) Finds the explicitly defined names, if any, of the given set ofEnumvalues.findFilterId(MapperConfig<?> config, Annotated a) Method for finding if annotated class has associated filter; and if so, to return id that is used to locate filter.findFormat(MapperConfig<?> config, Annotated ann) Method for finding format annotations for property or class.findImplicitPropertyName(MapperConfig<?> config, AnnotatedMember m) Method for finding implicit name for a property that given annotated member (field, method, creator parameter) may represent.findInjectableValue(MapperConfig<?> config, AnnotatedMember m) 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.findKeyDeserializer(MapperConfig<?> config, Annotated a) Method for getting a deserializer definition for keys of associatedMapproperty.findKeySerializer(MapperConfig<?> config, Annotated a) Method for getting a serializer definition for keys of associatedjava.util.Mapproperty.findMergeInfo(MapperConfig<?> config, Annotated a) Method for finding merge settings for property, if any.findNameForDeserialization(MapperConfig<?> config, Annotated a) Method for checking whether given property accessors (method, field) has an annotation that suggests property name to use for deserialization (reading JSON into POJOs).findNameForSerialization(MapperConfig<?> config, Annotated a) Method for checking whether given property accessors (method, field) has an annotation that suggests property name to use for serialization.findNamingStrategy(MapperConfig<?> config, AnnotatedClass ac) Method for findingPropertyNamingStrategyfor given class, if any specified by annotations; and if so, either return aPropertyNamingStrategyinstance, or Class to use for creating instancefindNullSerializer(MapperConfig<?> config, Annotated a) Method for getting a serializer definition for serializer to use for nulls (null values) of associated property or type.findObjectIdInfo(MapperConfig<?> config, Annotated 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.findObjectReferenceInfo(MapperConfig<?> config, Annotated ann, ObjectIdInfo objectIdInfo) Method for figuring out additional properties of an Object Identity referenceClass<?>findPOJOBuilder(MapperConfig<?> config, AnnotatedClass 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).findPOJOBuilderConfig(MapperConfig<?> config, AnnotatedClass ac) findPolymorphicTypeInfo(MapperConfig<?> config, Annotated ann) Method for checking whether given Class or Property Accessor specifies polymorphic type-handling information, to indicate need for polymorphic handling.findPropertyAccess(MapperConfig<?> config, Annotated m) Method for finding optional access definition for a property, annotated on one of its accessors.findPropertyAliases(MapperConfig<?> config, Annotated m) Method called to find if given property has alias(es) defined.findPropertyDefaultValue(MapperConfig<?> config, Annotated ann) Method for finding suggested default value (as simple textual serialization) for the property.findPropertyDescription(MapperConfig<?> config, Annotated ann) Method used to check whether specified property member (accessor or mutator) defines human-readable description to use for documentation.findPropertyIgnoralByName(MapperConfig<?> config, Annotated a) Method for finding information about properties to ignore either by name, or by more general specification ("ignore all unknown").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!).findPropertyInclusionByName(MapperConfig<?> config, Annotated a) Method for finding information about names of properties to included.findPropertyIndex(MapperConfig<?> 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.findReferenceType(MapperConfig<?> config, AnnotatedMember member) Method for checking if given member indicates that it is part of a reference (parent/child).findRenameByField(MapperConfig<?> config, AnnotatedField f, PropertyName 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.findRootName(MapperConfig<?> config, AnnotatedClass 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.findSerializationContentConverter(MapperConfig<?> config, AnnotatedMember a) Method for findingConverterthat 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).findSerializationConverter(MapperConfig<?> config, Annotated a) Method for findingConverterthat annotated entity (property or class) has indicated to be used as part of serialization.String[]findSerializationPropertyOrder(MapperConfig<?> config, AnnotatedClass ac) Method for accessing defined property serialization order (which may be partial).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) orderedfindSerializationTyping(MapperConfig<?> config, Annotated a) Method for accessing declared typing mode annotated (if any).findSerializer(MapperConfig<?> config, Annotated a) Method for getting a serializer definition on specified method or field.findSetterInfo(MapperConfig<?> config, Annotated a) Method for finding possible settings for property, given annotations on an accessor.findSubtypes(MapperConfig<?> config, Annotated a) Method for locating annotation-specified subtypes related to annotated entity (class, method, field).findTypeIdResolver(MapperConfig<?> config, Annotated ann) findTypeName(MapperConfig<?> config, AnnotatedClass ac) Method for checking if specified type has explicit name.findTypeResolverBuilder(MapperConfig<?> config, Annotated ann) findUnwrappingNameTransformer(MapperConfig<?> config, AnnotatedMember 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).findValueInstantiator(MapperConfig<?> config, AnnotatedClass ac) Method gettingValueInstantiatorto use for given type (class): return value can either be an instance of instantiator, or class of instantiator to create.Class<?>[]findViews(MapperConfig<?> config, Annotated 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.hasAnyGetter(MapperConfig<?> config, Annotated a) 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.hasAnySetter(MapperConfig<?> config, Annotated a) 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.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.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.booleanhasIgnoreMarker(MapperConfig<?> config, AnnotatedMember m) Method called to check whether given property is marked to be ignored.hasRequiredMarker(MapperConfig<?> config, AnnotatedMember m) Method that can be called to check whether this member has an annotation that suggests whether value for matching property is required or not.booleanAnnotations with meta-annotationJacksonAnnotationsInsideare considered bundles.isIgnorableType(MapperConfig<?> config, AnnotatedClass ac) Method for checking whether properties that have specified type (class, not generics aware) should be completely ignored for serialization and deserialization purposes.isTypeId(MapperConfig<?> config, AnnotatedMember 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.protected ObjectrefineDeserializationType(MapperConfig<?> config, Annotated a, JavaType baseType) Method called to find out possible type refinements to use for deserialization.refineSerializationType(MapperConfig<?> config, Annotated a, 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.resolveSetterConflict(MapperConfig<?> 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.setConstructorPropertiesImpliesCreator(boolean b) Method for changing behavior ofConstructorProperties: if set to `true`, existence DOES indicate that the given constructor should be considered a creator; `false` that it should NOT be considered a creator without explicit use ofJsonCreatorannotation.version()Methods inherited from class tools.jackson.databind.AnnotationIntrospector
_findAnnotation, _hasAnnotation, _hasOneOf, allIntrospectors, allIntrospectors, findPreferredCreator, findWrapperName, nopInstance, pair
-
Field Details
-
_annotationsInside
Since introspection of annotation types is a performance issue in some use cases (rare, but do exist), let's try a simple cache to reduce need for actual meta-annotation introspection.Non-final only because it needs to be re-created after deserialization.
-
_cfgConstructorPropertiesImpliesCreator
protected boolean _cfgConstructorPropertiesImpliesCreatorSeesetConstructorPropertiesImpliesCreator(boolean)for explanation.Defaults to true.
-
-
Constructor Details
-
JacksonAnnotationIntrospector
public JacksonAnnotationIntrospector()
-
-
Method Details
-
version
- Specified by:
versionin interfaceVersioned- Specified by:
versionin classAnnotationIntrospector
-
readResolve
-
setConstructorPropertiesImpliesCreator
Method for changing behavior ofConstructorProperties: if set to `true`, existence DOES indicate that the given constructor should be considered a creator; `false` that it should NOT be considered a creator without explicit use ofJsonCreatorannotation.Default setting is `true`
-
isAnnotationBundle
Annotations with meta-annotationJacksonAnnotationsInsideare considered bundles.- Overrides:
isAnnotationBundlein classAnnotationIntrospector- Parameters:
ann- Annotated entity to introspect- Returns:
- True if given annotation is considered an annotation bundle; false if not
-
findEnumValues
public String[] findEnumValues(MapperConfig<?> config, AnnotatedClass annotatedClass, Enum<?>[] enumValues, String[] names) Description copied from class:AnnotationIntrospectorFinds the explicitly defined names, if any, of the given set ofEnumvalues. The method overwrites entries in the incomingnamesarray with the explicit names found, if any, leaving other entries unmodified.- Overrides:
findEnumValuesin classAnnotationIntrospector- Parameters:
config- the mapper configuration to useannotatedClass- the annotated class for which to find the explicit namesenumValues- the set ofEnumvalues to find the explicit names fornames- the matching declared names of enumeration values (with indexes matchingenumValuesentries); modified as necessary- Returns:
- an array of names to use (usually
namespassed as argument)
-
findEnumAliases
public void findEnumAliases(MapperConfig<?> config, AnnotatedClass annotatedClass, Enum<?>[] enumValues, String[][] aliasList) Description copied from class:AnnotationIntrospectorMethod 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 toAnnotationIntrospector.findEnumValues(tools.jackson.databind.cfg.MapperConfig<?>, tools.jackson.databind.introspect.AnnotatedClass, java.lang.Enum<?>[], java.lang.String[]). These aliases should be returned inString[][] aliasespassed in as argument. Thealiases.lengthis expected to match the number ofEnumvalues.- Overrides:
findEnumAliasesin classAnnotationIntrospector- Parameters:
config- The configuration of the mapperannotatedClass- The annotated class of the enumeration typeenumValues- The values of the enumerationaliasList- (in/out) Pre-allocated array where aliases found, if any, may be added (in indexes matching those ofenumValues)
-
findDefaultEnumValue
public Enum<?> findDefaultEnumValue(MapperConfig<?> config, AnnotatedClass annotatedClass, Enum<?>[] enumValues) Finds the Enum value that should be considered the default value, if possible.This implementation relies on
JsonEnumDefaultValueannotation to determine the default value if present.- Overrides:
findDefaultEnumValuein classAnnotationIntrospector- Parameters:
annotatedClass- The Enum class to scan for the default value annotation.enumValues- The Enum values of the Enum class.- Returns:
- null if none found or it's not possible to determine one.
-
findRootName
Description copied from class:AnnotationIntrospectorMethod 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. Returns null if no declaration found; can return explicit empty String, which is usually ignored as well as null.- Overrides:
findRootNamein classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in useac- Annotated class to introspect
-
isIgnorableType
Description copied from class:AnnotationIntrospectorMethod for checking whether properties that have specified type (class, not generics aware) should be completely ignored for serialization and deserialization purposes.- Overrides:
isIgnorableTypein classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in useac- Annotated class to introspect- 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')
-
findPropertyIgnoralByName
Description copied from class:AnnotationIntrospectorMethod for finding information about properties to ignore either by name, or by more general specification ("ignore all unknown"). This method combines multiple aspects of name-based (as opposed to value-based) ignorals.- Overrides:
findPropertyIgnoralByNamein classAnnotationIntrospector- Parameters:
config- Configuration settings in effect (for serialization or deserialization)a- Annotated entity (Class, Accessor) to introspect
-
findPropertyInclusionByName
Description copied from class:AnnotationIntrospectorMethod for finding information about names of properties to included. This is typically used to strictly limit properties to include based on fully defined set of names ("allow-listing"), as opposed to excluding potential properties by exclusion ("deny-listing").- Overrides:
findPropertyInclusionByNamein classAnnotationIntrospector- Parameters:
config- Configuration settings in effect (for serialization or deserialization)a- Annotated entity (Class, Accessor) to introspect
-
findFilterId
Description copied from class:AnnotationIntrospectorMethod for finding if annotated class has associated filter; and if so, to return id that is used to locate filter.- Overrides:
findFilterIdin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in usea- Annotated entity to introspect- Returns:
- Id of the filter to use for filtering properties of annotated class, if any; or null if none found.
-
findNamingStrategy
Description copied from class:AnnotationIntrospectorMethod for findingPropertyNamingStrategyfor given class, if any specified by annotations; and if so, either return aPropertyNamingStrategyinstance, or Class to use for creating instance- Overrides:
findNamingStrategyin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in useac- Annotated class to introspect- Returns:
- Sub-class or instance of
PropertyNamingStrategy, if one is specified for given class; null if not.
-
findEnumNamingStrategy
Description copied from class:AnnotationIntrospectorMethod for findingEnumNamingStrategyfor given class, if any specified by annotations; and if so, either return aEnumNamingStrategyinstance, or Class to use for creating instance- Overrides:
findEnumNamingStrategyin classAnnotationIntrospectorac- Annotated class to introspect- Returns:
- Subclass or instance of
EnumNamingStrategy, if one is specified for given class; null if not.
-
findClassDescription
Description copied from class:AnnotationIntrospectorMethod used to check whether specified class defines a human-readable description to use for documentation. There are no further definitions for contents; for example, whether these may be marked up using HTML (or something like wiki format like Markup) is not defined.- Overrides:
findClassDescriptionin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in useac- Annotated class to introspect- Returns:
- Human-readable description, if any.
-
findAutoDetectVisibility
public VisibilityChecker findAutoDetectVisibility(MapperConfig<?> config, AnnotatedClass ac, VisibilityChecker checker) Description copied from class:AnnotationIntrospectorMethod for checking if annotations indicate changes to minimum visibility levels needed for auto-detecting property elements (fields, methods, constructors). A baseline checker is given, and introspector is to either return it as is (if no annotations are found), or build and return a derived instance (using checker's build methods).- Overrides:
findAutoDetectVisibilityin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in useac- Annotated class to introspect
-
findImplicitPropertyName
Description copied from class:AnnotationIntrospectorMethod for finding implicit name for a property that given annotated member (field, method, creator parameter) may represent. This is different from explicit, annotation-based property name, in that it is "weak" and does not either prove that a property exists (for example, if visibility is not high enough), or override explicit names. In practice this method is used to introspect optional names for creator parameters (which may or may not be available and cannot be detected by standard databind); or to provide alternate name mangling for fields, getters and/or setters.- Overrides:
findImplicitPropertyNamein classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in use
-
_findImplicitName
-
findPropertyAliases
Description copied from class:AnnotationIntrospectorMethod called to find if given property has alias(es) defined.- Overrides:
findPropertyAliasesin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in use- Returns:
- `null` if member has no information; otherwise a `List` (possibly empty) of aliases to use.
-
hasIgnoreMarker
Description copied from class:AnnotationIntrospectorMethod 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).- Overrides:
hasIgnoreMarkerin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in usem- Member to check for information
-
hasRequiredMarker
Description copied from class:AnnotationIntrospectorMethod that can be called to check whether this member has an annotation that suggests whether value for matching property is required or not.- Overrides:
hasRequiredMarkerin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in usem- Member to check for information
-
findPropertyAccess
Description copied from class:AnnotationIntrospectorMethod for finding optional access definition for a property, annotated on one of its accessors. If a definition for read-only, write-only or read-write cases, visibility rules may be modified. Note, however, that even more specific annotations (like one for ignoring specific accessor) may further override behavior of the access definition.- Overrides:
findPropertyAccessin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in use
-
findPropertyDescription
Description copied from class:AnnotationIntrospectorMethod used to check whether specified property member (accessor or mutator) defines human-readable description to use for documentation. There are no further definitions for contents; for example, whether these may be marked up using HTML is not defined.- Overrides:
findPropertyDescriptionin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in use- Returns:
- Human-readable description, if any.
-
findPropertyIndex
Description copied from class:AnnotationIntrospectorMethod used to check whether specified property member (accessor or mutator) defines numeric index, and if so, what is the index value. Possible use cases for index values included use by underlying data format (some binary formats mandate use of index instead of name) and ordering of properties (for documentation, or during serialization).- Overrides:
findPropertyIndexin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in use- Returns:
- Explicitly specified index for the property, if any
-
findPropertyDefaultValue
Description copied from class:AnnotationIntrospectorMethod 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.- Overrides:
findPropertyDefaultValuein classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in use
-
findFormat
Description copied from class:AnnotationIntrospectorMethod for finding format annotations for property or class. Return value is typically used by serializers and/or deserializers to customize presentation aspects of the serialized value.- Overrides:
findFormatin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in use
-
findReferenceType
public AnnotationIntrospector.ReferenceProperty findReferenceType(MapperConfig<?> config, AnnotatedMember member) Description copied from class:AnnotationIntrospectorMethod for checking if given member indicates that it is part of a reference (parent/child).- Overrides:
findReferenceTypein classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in usemember- Member to check for information
-
findUnwrappingNameTransformer
public NameTransformer findUnwrappingNameTransformer(MapperConfig<?> config, AnnotatedMember member) Description copied from class:AnnotationIntrospectorMethod 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). Return value is the name transformation to use, if wrapping/unwrapping should be done, or null if not -- note that transformation may simply be identity transformation (no changes).- Overrides:
findUnwrappingNameTransformerin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in usemember- Member to check for information
-
findInjectableValue
Description copied from class:AnnotationIntrospectorMethod 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. Type if identifier needs to be compatible with provider of values (of typeInjectableValues); often a simple String id is used.- Overrides:
findInjectableValuein classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in usem- Member to check for information- Returns:
- Identifier of value to inject, if any; null if no injection indicator is found
-
findViews
Description copied from class:AnnotationIntrospectorMethod 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. View matches are checked using class inheritance rules (sub-classes inherit inclusions of super-classes)Since 2.9 this method may also be called to find "default view(s)" for
AnnotatedClass- Overrides:
findViewsin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in usea- Annotated property (represented by a method, field or ctor parameter)- Returns:
- Array of views (represented by classes) that the property is included in;
if null, always included (same as returning array containing
Object.class)
-
resolveSetterConflict
public AnnotatedMethod resolveSetterConflict(MapperConfig<?> config, AnnotatedMethod setter1, AnnotatedMethod setter2) Description copied from class:AnnotationIntrospectorMethod 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. Introspector may try to choose one to use; or, if unable, return `null` to indicate it cannot resolve the problem.- Overrides:
resolveSetterConflictin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in use
-
findRenameByField
public PropertyName findRenameByField(MapperConfig<?> config, AnnotatedField f, PropertyName implName) Description copied from class:AnnotationIntrospectorMethod 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. Call will be made after finding implicit name (which by default is just name of the field, but may be overridden by introspector), but before discovering other accessors. If non-null name returned, it is to be used to find other accessors (getters, setters, creator parameters) and replace their implicit names with that of field's implicit name (assuming they differ).Specific example (and initial use case is for support Kotlin's "is getter" matching (see Kotling Interop for details), in which field like '
isOpen' would have implicit name of "isOpen", match gettergetOpen()and settersetOpen(boolean), but use logical external name of "isOpen" (and not implicit name of getter/setter, "open"!). To achieve this, field implicit name needs to remain "isOpen" but this method needs to return namePropertyName.construct("open"): doing so will "pull in" getter and/or setter, and rename them as "isOpen".- Overrides:
findRenameByFieldin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in usef- Field to checkimplName- Implicit name of the field; usually name of field itself but not always, used as the target name for accessors to rename.- Returns:
- Name used to find other accessors to rename, if any;
nullto indicate no renaming
-
findPolymorphicTypeInfo
Description copied from class:AnnotationIntrospectorMethod for checking whether given Class or Property Accessor specifies polymorphic type-handling information, to indicate need for polymorphic handling.- Overrides:
findPolymorphicTypeInfoin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in useann- Annotated entity to introspect
-
findTypeResolverBuilder
- Overrides:
findTypeResolverBuilderin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in useann- Annotated entity to introspect
-
findTypeIdResolver
- Overrides:
findTypeIdResolverin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in useann- Annotated entity to introspect
-
findSubtypes
Description copied from class:AnnotationIntrospectorMethod 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)- Overrides:
findSubtypesin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in usea- Annotated entity (class, field/method) to check for annotations
-
findTypeName
Description copied from class:AnnotationIntrospectorMethod for checking if specified type has explicit name.- Overrides:
findTypeNamein classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in useac- Class to check for type name annotations
-
isTypeId
Description copied from class:AnnotationIntrospectorMethod 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.- Overrides:
isTypeIdin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in usemember- Member to check for type id information
-
findObjectIdInfo
Description copied from class:AnnotationIntrospectorMethod 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.- Overrides:
findObjectIdInfoin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in useann- Annotated entity to introspect- Returns:
- Details of Object Id as explained above, if Object Id
handling to be applied;
nullotherwise.
-
findObjectReferenceInfo
public ObjectIdInfo findObjectReferenceInfo(MapperConfig<?> config, Annotated ann, ObjectIdInfo objectIdInfo) Description copied from class:AnnotationIntrospectorMethod for figuring out additional properties of an Object Identity reference- Overrides:
findObjectReferenceInfoin classAnnotationIntrospector- Parameters:
config- Effective mapper configuration in useann- Annotated entity to introspectobjectIdInfo- (optional) Base Object Id information, if any;nullif none- Returns:
ObjectIdInfoaugmented with possible additional information
-
findSerializer
Description copied from class:AnnotationIntrospectorMethod for getting a serializer definition on specified method or field. Type of definition is either instance (of typeValueSerializer) or Class (ofClass<ValueSerializer>implementation subtype); if value of different type is returned, a runtime exception may be thrown by caller.- Overrides:
findSerializerin classAnnotationIntrospector
-
findKeySerializer
Description copied from class:AnnotationIntrospectorMethod for getting a serializer definition for keys of associatedjava.util.Mapproperty. Type of definition is either instance (of typeValueSerializer) or Class (of typeClass<ValueSerializer>); if value of different type is returned, a runtime exception may be thrown by caller.- Overrides:
findKeySerializerin classAnnotationIntrospector
-
findContentSerializer
Description copied from class:AnnotationIntrospectorMethod for getting a serializer definition for content (values) of associatedCollection,arrayorMapproperty. Type of definition is either instance (of typeValueSerializer) or Class (of typeClass<ValueSerializer>); if value of different type is returned, a runtime exception may be thrown by caller.- Overrides:
findContentSerializerin classAnnotationIntrospector
-
findNullSerializer
Description copied from class:AnnotationIntrospectorMethod for getting a serializer definition for serializer to use for nulls (null values) of associated property or type.- Overrides:
findNullSerializerin classAnnotationIntrospector
-
findPropertyInclusion
Description copied from class:AnnotationIntrospectorMethod for checking inclusion criteria for a type (Class) or property (yes, method name is bit unfortunate -- not just for properties!). In case of class, acts as the default for properties POJO contains; for properties acts as override for class defaults and possible global defaults.- Overrides:
findPropertyInclusionin classAnnotationIntrospector
-
findSerializationTyping
Description copied from class:AnnotationIntrospectorMethod for accessing declared typing mode annotated (if any). This is used for type detection, unless more granular settings (such as actual exact type; or serializer to use which means no type information is needed) take precedence.- Overrides:
findSerializationTypingin classAnnotationIntrospector- Returns:
- Typing mode to use, if annotation is found; null otherwise
-
findSerializationConverter
Description copied from class:AnnotationIntrospectorMethod for findingConverterthat annotated entity (property or class) has indicated to be used as part of serialization. If not null, either has to be actualConverterinstance, or class for such converter; and resulting converter will be used first to convert property value to converter target type, and then serializer for that type is used for actual serialization.This feature is typically used to convert internal values into types that Jackson can convert.
Note also that this feature does not necessarily work well with polymorphic type handling, or object identity handling; if such features are needed an explicit serializer is usually better way to handle serialization.
- Overrides:
findSerializationConverterin classAnnotationIntrospectora- Annotated property (field, method) or class to check for annotations
-
findSerializationContentConverter
Description copied from class:AnnotationIntrospectorMethod for findingConverterthat 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).If not null, either has to be actual
Converterinstance, or class for such converter; and resulting converter will be used first to convert property value to converter target type, and then serializer for that type is used for actual serialization.Other notes are same as those for
AnnotationIntrospector.findSerializationConverter(tools.jackson.databind.cfg.MapperConfig<?>, tools.jackson.databind.introspect.Annotated)- Overrides:
findSerializationContentConverterin classAnnotationIntrospectora- Annotated property (field, method) to check.
-
refineSerializationType
Description copied from class:AnnotationIntrospectorMethod 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.- Overrides:
refineSerializationTypein classAnnotationIntrospector
-
findSerializationPropertyOrder
Description copied from class:AnnotationIntrospectorMethod for accessing defined property serialization order (which may be partial). May return null if no ordering is defined.- Overrides:
findSerializationPropertyOrderin classAnnotationIntrospector
-
findSerializationSortAlphabetically
Description copied from class:AnnotationIntrospectorMethod for checking whether an annotation indicates that serialized properties for which no explicit is defined should be alphabetically (lexicograpically) ordered- Overrides:
findSerializationSortAlphabeticallyin classAnnotationIntrospector
-
findAndAddVirtualProperties
public void findAndAddVirtualProperties(MapperConfig<?> config, AnnotatedClass ac, List<BeanPropertyWriter> properties) Description copied from class:AnnotationIntrospectorMethod for adding possible virtual properties to be serialized along with regular properties.- Overrides:
findAndAddVirtualPropertiesin classAnnotationIntrospector
-
_constructVirtualProperty
protected BeanPropertyWriter _constructVirtualProperty(JsonAppend.Attr attr, MapperConfig<?> config, AnnotatedClass ac, JavaType type) -
_constructVirtualProperty
protected BeanPropertyWriter _constructVirtualProperty(JsonAppend.Prop prop, MapperConfig<?> config, AnnotatedClass ac) -
findNameForSerialization
Description copied from class:AnnotationIntrospectorMethod 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 (possiblyPropertyName.USE_DEFAULT, which means "use default heuristics").- Overrides:
findNameForSerializationin classAnnotationIntrospectora- Property accessor to check- Returns:
- Name to use if found; null if not.
-
hasAsKey
Description copied from class:AnnotationIntrospectorMethod 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.- Overrides:
hasAsKeyin classAnnotationIntrospector- Returns:
Boolean.TRUEif such annotation is found and is not disabled;Boolean.FALSEif disabled annotation (block) is found (to indicate accessor is definitely NOT to be used "as value"); or `null` if no information found.
-
hasAsValue
Description copied from class:AnnotationIntrospectorMethod 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.- Overrides:
hasAsValuein classAnnotationIntrospector- Returns:
Boolean.TRUEif such annotation is found and is not disabled;Boolean.FALSEif disabled annotation (block) is found (to indicate accessor is definitely NOT to be used "as value"); or `null` if no information found.
-
hasAnyGetter
Description copied from class:AnnotationIntrospectorMethod 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.- Overrides:
hasAnyGetterin classAnnotationIntrospectora- Annotated entity to check- Returns:
- True if such annotation is found (and is not disabled), false otherwise
-
findDeserializer
Description copied from class:AnnotationIntrospectorMethod for getting a deserializer definition on specified method or field. Type of definition is either instance (of typeValueDeserializer) or Class (of typeClass&<ValueDeserializer>); type is returned, a runtime exception may be thrown by caller.- Overrides:
findDeserializerin classAnnotationIntrospector
-
findKeyDeserializer
Description copied from class:AnnotationIntrospectorMethod for getting a deserializer definition for keys of associatedMapproperty. Type of definition is either instance (of typeValueDeserializer) or Class (of typeClass<ValueDeserializer>); if value of different type is returned, a runtime exception may be thrown by caller.- Overrides:
findKeyDeserializerin classAnnotationIntrospector
-
findContentDeserializer
Description copied from class:AnnotationIntrospectorMethod for getting a deserializer definition for content (values) of associatedCollection,arrayorMapproperty. Type of definition is either instance (of typeValueDeserializer) or Class (of typeClass<ValueDeserializer>); if value of different type is returned, a runtime exception may be thrown by caller.- Overrides:
findContentDeserializerin classAnnotationIntrospector
-
findDeserializationConverter
Description copied from class:AnnotationIntrospectorMethod for findingConverterthat annotated entity (property or class) has indicated to be used as part of deserialization. If not null, either has to be actualConverterinstance, or class for such converter; and resulting converter will be used after Jackson has deserializer data into intermediate type (Converter input type), and Converter needs to convert this into its target type to be set as property value.This feature is typically used to convert intermediate Jackson types (that default deserializers can produce) into custom type instances.
Note also that this feature does not necessarily work well with polymorphic type handling, or object identity handling; if such features are needed an explicit deserializer is usually better way to handle deserialization.
- Overrides:
findDeserializationConverterin classAnnotationIntrospectora- Annotated property (field, method) or class to check for annotations
-
findDeserializationContentConverter
Description copied from class:AnnotationIntrospectorMethod for findingConverterthat 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).If not null, either has to be actual
Converterinstance, or class for such converter; and resulting converter will be used after Jackson has deserializer data into intermediate type (Converter input type), and Converter needs to convert this into its target type to be set as property value.Other notes are same as those for
AnnotationIntrospector.findDeserializationConverter(tools.jackson.databind.cfg.MapperConfig<?>, tools.jackson.databind.introspect.Annotated)- Overrides:
findDeserializationContentConverterin classAnnotationIntrospectora- Annotated property (field, method) to check.
-
refineDeserializationType
Description copied from class:AnnotationIntrospectorMethod called to find out possible type refinements to use for deserialization.- Overrides:
refineDeserializationTypein classAnnotationIntrospector
-
findValueInstantiator
Description copied from class:AnnotationIntrospectorMethod gettingValueInstantiatorto use for given type (class): return value can either be an instance of instantiator, or class of instantiator to create.- Overrides:
findValueInstantiatorin classAnnotationIntrospectorac- Annotated class to introspect
-
findPOJOBuilder
Description copied from class:AnnotationIntrospectorMethod 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).Note that unlike accessors for some helper Objects, this method does not allow returning instances: the reason is that builders have state, and a separate instance needs to be created for each deserialization call.
- Overrides:
findPOJOBuilderin classAnnotationIntrospectorac- Annotated class to introspect
-
findPOJOBuilderConfig
- Overrides:
findPOJOBuilderConfigin classAnnotationIntrospectorac- Annotated class to introspect
-
findNameForDeserialization
Description copied from class:AnnotationIntrospectorMethod 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 (possiblyPropertyName.USE_DEFAULT, which means "use default heuristics").- Overrides:
findNameForDeserializationin classAnnotationIntrospectora- Annotated entity to check- Returns:
- Name to use if found; null if not.
-
hasAnySetter
Description copied from class:AnnotationIntrospectorMethod 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.- Overrides:
hasAnySetterin classAnnotationIntrospectora- Annotated entity to check- Returns:
- True if such annotation is found (and is not disabled), false otherwise
-
findSetterInfo
Description copied from class:AnnotationIntrospectorMethod for finding possible settings for property, given annotations on an accessor.- Overrides:
findSetterInfoin classAnnotationIntrospector
-
findMergeInfo
Description copied from class:AnnotationIntrospectorMethod for finding merge settings for property, if any.- Overrides:
findMergeInfoin classAnnotationIntrospector
-
findCreatorAnnotation
Description copied from class:AnnotationIntrospectorMethod called to check whether potential Creator (constructor or static factory method) has explicit annotation to indicate it as actual Creator; and if so, whichJsonCreator.Modeto use.NOTE: caller needs to consider possibility of both `null` (no annotation found) and
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.- Overrides:
findCreatorAnnotationin classAnnotationIntrospector- Parameters:
config- Configuration settings in effect (for serialization or deserialization)a- Annotated accessor (usually constructor or static method) to check
-
_isIgnorable
-
_classIfExplicit
-
_classIfExplicit
-
_propertyName
-