Top Description Fields Constructors Methods
com.fasterxml.jackson.databind.introspect

public Class POJOPropertiesCollector

extends Object
Class Inheritance
Imports
java.lang.reflect.Modifier, java.util.*, com.fasterxml.jackson.annotation.JacksonInject, .JsonCreator, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.cfg.HandlerInstantiator, .MapperConfig, com.fasterxml.jackson.databind.jdk14.JDK14Util, com.fasterxml.jackson.databind.util.ClassUtil

Helper class used for aggregating information about all possible properties of a POJO.

Field Summary

Modifier and TypeField and Description
protected final AccessorNamingStrategy
_accessorNaming

Handler used for name-mangling of getter, mutator (setter/with) methods

protected final AnnotationIntrospector
protected LinkedList<AnnotatedMember>
protected LinkedList<AnnotatedMember>
protected LinkedList<AnnotatedMember>
protected LinkedList<AnnotatedMethod>
protected final AnnotatedClass
_classDef

Low-level introspected class information (methods, fields etc)

protected boolean
_collected

State flag we keep to indicate whether actual property information has been collected or not.

protected final MapperConfig<?>
_config

Configuration settings

protected LinkedList<POJOPropertyBuilder>
protected Map<PropertyName, PropertyName>
_fieldRenameMappings

A set of "field renamings" that have been discovered, indicating intended renaming of other accessors: key is the implicit original name and value intended name to use instead.

protected final boolean
_forSerialization

True if introspection is done for serialization (giving precedence for serialization annotations), or not (false, deserialization)

protected HashSet<String>
_ignoredPropertyNames

Lazily collected list of properties that can be implicitly ignored during serialization; only updated when collecting information for deserialization purposes

protected LinkedHashMap<Object, AnnotatedMember>
_injectables

Lazily collected list of members that were annotated to indicate that they represent mutators for deserializer value injection.

protected final boolean
protected LinkedList<AnnotatedMember>
_jsonKeyAccessors

Accessors (field or "getter" method annotated with com.fasterxml.jackson.annotation.JsonKey

protected LinkedList<AnnotatedMember>
_jsonValueAccessors

Accessors (field or "getter" method) annotated with com.fasterxml.jackson.annotation.JsonValue

protected String
_mutatorPrefix

Deprecated Since 2.12
protected LinkedHashMap<String, POJOPropertyBuilder>
_properties

Set of logical property information collected so far.

protected final boolean
_stdBeanNaming

Deprecated Since 2.12
protected final JavaType
_type

Type of POJO for which properties are being collected.

protected final boolean
protected final VisibilityChecker<?>

Constructor Summary

AccessConstructor and Description
protected
POJOPropertiesCollector(MapperConfig<?> config, boolean forSerialization, JavaType type, AnnotatedClass classDef, AccessorNamingStrategy accessorNaming)

protected
POJOPropertiesCollector(MapperConfig<?> config, boolean forSerialization, JavaType type, AnnotatedClass classDef, String mutatorPrefix)

Deprecated Since 2.12

Method Summary

Modifier and TypeMethod and Description
private static AccessorNamingStrategy
_accessorNaming(MapperConfig<?> config, AnnotatedClass classDef, String mutatorPrefix)

protected void
private void
protected void
_addCreators(Map<String, POJOPropertyBuilder> props)

Method for collecting basic information on constructor(s) found

protected void
_addFields(Map<String, POJOPropertyBuilder> props)

Method for collecting basic information on all fields found

protected void
protected void
protected void
_addMethods(Map<String, POJOPropertyBuilder> props)

Method for collecting basic information on all fields found

protected void
private boolean
private String
protected void
_collectIgnorals(String name)

Helper method called to add explicitly ignored properties to a list of known ignored properties; this helps in proper reporting of errors.

protected void
private PropertyNamingStrategy
protected POJOPropertyBuilder
protected POJOPropertyBuilder
private PropertyName
protected void
_removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)

Method called to further get rid of unwanted individual accessors, based on read/write settings and rules for "pulling in" accessors (or not).

protected void
_removeUnwantedProperties(Map<String, POJOPropertyBuilder> props)

Method called to get rid of candidate properties that are marked as ignored.

protected void
protected void
protected void
protected boolean
protected boolean

Returns:

True if seeming conflict was resolved and there only remains single accessor
_resolveFieldVsGetter
(List<AnnotatedMember> accessors)

Method that will be given a List with 2 or more accessors that may be in conflict: it will need to remove lower-priority accessors to leave just a single highest-priority accessor to use.

protected void
protected void
protected void
collectAll()

Internal method that will collect actual property information.

public Class<?>
findPOJOBuilderClass()

Deprecated
public AnnotationIntrospector
public AnnotatedMember
getAnyGetter()

Deprecated Since 2.12 use separate getAnyGetterMethod() and getAnyGetterField().
Alias for getAnyGetterMethod().
public AnnotatedMember
public AnnotatedMember
public AnnotatedMember
public AnnotatedMethod
public AnnotatedClass
public MapperConfig<?>
public Set<String>
getIgnoredPropertyNames()

Accessor for set of properties that are explicitly marked to be ignored via per-property markers (but NOT class annotations).

public Map<Object, AnnotatedMember>
public AnnotatedMember
public AnnotatedMember
public AnnotatedMethod
getJsonValueMethod()

Deprecated
public ObjectIdInfo
getObjectIdInfo()

Accessor to find out whether type specified requires inclusion of Object Identifier.

public List<BeanPropertyDefinition>
protected Map<String, POJOPropertyBuilder>
public JavaType
public boolean
protected void
reportProblem(String msg, Object... args)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_accessorNamingback to summary
protected final AccessorNamingStrategy _accessorNaming

Handler used for name-mangling of getter, mutator (setter/with) methods

Since
2.12
_annotationIntrospectorback to summary
protected final AnnotationIntrospector _annotationIntrospector
_anyGetterFieldback to summary
protected LinkedList<AnnotatedMember> _anyGetterField
Since
2.12
_anyGettersback to summary
protected LinkedList<AnnotatedMember> _anyGetters
_anySetterFieldback to summary
protected LinkedList<AnnotatedMember> _anySetterField
_anySettersback to summary
protected LinkedList<AnnotatedMethod> _anySetters
_classDefback to summary
protected final AnnotatedClass _classDef

Low-level introspected class information (methods, fields etc)

_collectedback to summary
protected boolean _collected

State flag we keep to indicate whether actual property information has been collected or not.

_configback to summary
protected final MapperConfig<?> _config

Configuration settings

_creatorPropertiesback to summary
protected LinkedList<POJOPropertyBuilder> _creatorProperties
_fieldRenameMappingsback to summary
protected Map<PropertyName, PropertyName> _fieldRenameMappings

A set of "field renamings" that have been discovered, indicating intended renaming of other accessors: key is the implicit original name and value intended name to use instead.

Note that these renamings are applied earlier than "regular" (explicit) renamings and affect implicit name: their effect may be changed by further renaming based on explicit indicators. The main use case is to effectively relink accessors based on fields discovered, and used to sort of correct otherwise missing linkage between fields and other accessors.

Since
2.11
_forSerializationback to summary
protected final boolean _forSerialization

True if introspection is done for serialization (giving precedence for serialization annotations), or not (false, deserialization)

_ignoredPropertyNamesback to summary
protected HashSet<String> _ignoredPropertyNames

Lazily collected list of properties that can be implicitly ignored during serialization; only updated when collecting information for deserialization purposes

_injectablesback to summary
protected LinkedHashMap<Object, AnnotatedMember> _injectables

Lazily collected list of members that were annotated to indicate that they represent mutators for deserializer value injection.

_isRecordTypeback to summary
protected final boolean _isRecordType
Since
2.15
_jsonKeyAccessorsback to summary
protected LinkedList<AnnotatedMember> _jsonKeyAccessors

Accessors (field or "getter" method annotated with com.fasterxml.jackson.annotation.JsonKey

Since
2.12
_jsonValueAccessorsback to summary
protected LinkedList<AnnotatedMember> _jsonValueAccessors

Accessors (field or "getter" method) annotated with com.fasterxml.jackson.annotation.JsonValue

_mutatorPrefixback to summary
protected String _mutatorPrefix

Deprecated

Since 2.12

Annotations
@Deprecated
_propertiesback to summary
protected LinkedHashMap<String, POJOPropertyBuilder> _properties

Set of logical property information collected so far.

Since 2.6, this has been constructed (more) lazily, to defer throwing of exceptions for potential conflicts in cases where this may not be an actual problem.

_stdBeanNamingback to summary
protected final boolean _stdBeanNaming

Deprecated

Since 2.12

Annotations
@Deprecated
_typeback to summary
protected final JavaType _type

Type of POJO for which properties are being collected.

_useAnnotationsback to summary
protected final boolean _useAnnotations
Since
2.9
_visibilityCheckerback to summary
protected final VisibilityChecker<?> _visibilityChecker

Constructor Detail

POJOPropertiesCollectorback to summary
protected POJOPropertiesCollector(MapperConfig<?> config, boolean forSerialization, JavaType type, AnnotatedClass classDef, AccessorNamingStrategy accessorNaming)
Since
2.12
POJOPropertiesCollectorback to summary
protected POJOPropertiesCollector(MapperConfig<?> config, boolean forSerialization, JavaType type, AnnotatedClass classDef, String mutatorPrefix)

Deprecated

Since 2.12

Annotations
@Deprecated

Method Detail

_accessorNamingback to summary
private static AccessorNamingStrategy _accessorNaming(MapperConfig<?> config, AnnotatedClass classDef, String mutatorPrefix)
_addCreatorParamback to summary
protected void _addCreatorParam(Map<String, POJOPropertyBuilder> props, AnnotatedParameter param)
Since
2.4
_addCreatorParamback to summary
private void _addCreatorParam(Map<String, POJOPropertyBuilder> props, AnnotatedParameter param, String recordComponentName)
_addCreatorsback to summary
protected void _addCreators(Map<String, POJOPropertyBuilder> props)

Method for collecting basic information on constructor(s) found

_addFieldsback to summary
protected void _addFields(Map<String, POJOPropertyBuilder> props)

Method for collecting basic information on all fields found

_addGetterMethodback to summary
protected void _addGetterMethod(Map<String, POJOPropertyBuilder> props, AnnotatedMethod m, AnnotationIntrospector ai)
_addInjectablesback to summary
protected void _addInjectables(Map<String, POJOPropertyBuilder> props)
_addMethodsback to summary
protected void _addMethods(Map<String, POJOPropertyBuilder> props)

Method for collecting basic information on all fields found

_addSetterMethodback to summary
protected void _addSetterMethod(Map<String, POJOPropertyBuilder> props, AnnotatedMethod m, AnnotationIntrospector ai)
_anyIndexedback to summary
private boolean _anyIndexed(Collection<POJOPropertyBuilder> props)
_checkRenameByFieldback to summary
private String _checkRenameByField(String implName)
_collectIgnoralsback to summary
protected void _collectIgnorals(String name)

Helper method called to add explicitly ignored properties to a list of known ignored properties; this helps in proper reporting of errors.

_doAddInjectableback to summary
protected void _doAddInjectable(JacksonInject.Value injectable, AnnotatedMember m)
_findNamingStrategyback to summary
private PropertyNamingStrategy _findNamingStrategy()
_propertyback to summary
protected POJOPropertyBuilder _property(Map<String, POJOPropertyBuilder> props, PropertyName name)
_propertyback to summary
protected POJOPropertyBuilder _property(Map<String, POJOPropertyBuilder> props, String implName)
_propNameFromSimpleback to summary
private PropertyName _propNameFromSimple(String simpleName)
_removeUnwantedAccessorback to summary
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)

Method called to further get rid of unwanted individual accessors, based on read/write settings and rules for "pulling in" accessors (or not).

_removeUnwantedPropertiesback to summary
protected void _removeUnwantedProperties(Map<String, POJOPropertyBuilder> props)

Method called to get rid of candidate properties that are marked as ignored.

_renamePropertiesback to summary
protected void _renameProperties(Map<String, POJOPropertyBuilder> props)
_renameUsingback to summary
protected void _renameUsing(Map<String, POJOPropertyBuilder> propMap, PropertyNamingStrategy naming)
_renameWithWrappersback to summary
protected void _renameWithWrappers(Map<String, POJOPropertyBuilder> props)
_replaceCreatorPropertyback to summary
protected boolean _replaceCreatorProperty(POJOPropertyBuilder prop, List<POJOPropertyBuilder> creatorProperties)
_resolveFieldVsGetterback to summary
protected boolean _resolveFieldVsGetter(List<AnnotatedMember> accessors)

Method that will be given a List with 2 or more accessors that may be in conflict: it will need to remove lower-priority accessors to leave just a single highest-priority accessor to use. If this succeeds method returns true, otherwise false.

Note

method will directly modify given List directly, regardless of whether it ultimately succeeds or not.

Returns:boolean

True if seeming conflict was resolved and there only remains single accessor

_sortPropertiesback to summary
protected void _sortProperties(Map<String, POJOPropertyBuilder> props)
_updateCreatorPropertyback to summary
protected void _updateCreatorProperty(POJOPropertyBuilder prop, List<POJOPropertyBuilder> creatorProperties)

Deprecated

Annotations
@Deprecated
collectAllback to summary
protected void collectAll()

Internal method that will collect actual property information.

Since
2.6
findPOJOBuilderClassback to summary
public Class<?> findPOJOBuilderClass()

Deprecated

Annotations
@Deprecated
getAnnotationIntrospectorback to summary
public AnnotationIntrospector getAnnotationIntrospector()
getAnyGetterback to summary
public AnnotatedMember getAnyGetter()

Deprecated

Since 2.12 use separate getAnyGetterMethod() and getAnyGetterField().

Alias for getAnyGetterMethod().

Annotations
@Deprecated
getAnyGetterFieldback to summary
public AnnotatedMember getAnyGetterField()
Since
2.12 (before only had "getAnyGetter()")
getAnyGetterMethodback to summary
public AnnotatedMember getAnyGetterMethod()
Since
2.12 (before only had "getAnyGetter()")
getAnySetterFieldback to summary
public AnnotatedMember getAnySetterField()
getAnySetterMethodback to summary
public AnnotatedMethod getAnySetterMethod()
getClassDefback to summary
public AnnotatedClass getClassDef()
getConfigback to summary
public MapperConfig<?> getConfig()
getIgnoredPropertyNamesback to summary
public Set<String> getIgnoredPropertyNames()

Accessor for set of properties that are explicitly marked to be ignored via per-property markers (but NOT class annotations).

getInjectablesback to summary
public Map<Object, AnnotatedMember> getInjectables()
getJsonKeyAccessorback to summary
public AnnotatedMember getJsonKeyAccessor()
Since
2.12
getJsonValueAccessorback to summary
public AnnotatedMember getJsonValueAccessor()
Since
2.9
getJsonValueMethodback to summary
public AnnotatedMethod getJsonValueMethod()

Deprecated

Annotations
@Deprecated
getObjectIdInfoback to summary
public ObjectIdInfo getObjectIdInfo()

Accessor to find out whether type specified requires inclusion of Object Identifier.

getPropertiesback to summary
public List<BeanPropertyDefinition> getProperties()
getPropertyMapback to summary
protected Map<String, POJOPropertyBuilder> getPropertyMap()
getTypeback to summary
public JavaType getType()
isRecordTypeback to summary
public boolean isRecordType()
Since
2.15
reportProblemback to summary
protected void reportProblem(String msg, Object... args)