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, .JsonFormat, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.cfg.ConstructorDetector, .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 List<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 JsonFormat.Value
_formatOverrides

Lazily accessed information about POJO format overrides

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 PotentialCreators
protected LinkedHashMap<String, POJOPropertyBuilder>
_properties

Set of logical property information collected so far.

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)

Method Summary

Modifier and TypeMethod and Description
private void
protected void
private void
private void
protected void
_addFields(Map<String, POJOPropertyBuilder> props)

Method for collecting basic information on all fields found

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

Method for collecting basic information on all accessor methods found

protected void
private boolean
private String
private List<PotentialCreator>
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 List<PotentialCreator>
private PropertyNamingStrategy
private boolean
private boolean
protected POJOPropertyBuilder
protected POJOPropertyBuilder
private PropertyName
private void
private void
private void
protected void
_removeUnwantedAccessors(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
collectAll()

Internal method that will collect actual property information.

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 JsonFormat.Value
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 ObjectIdInfo
getObjectIdInfo()

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

public PotentialCreators
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 List<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
_formatOverridesback to summary
protected JsonFormat.Value _formatOverrides

Lazily accessed information about POJO format overrides

Since
2.17
_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

_potentialCreatorsback to summary
protected PotentialCreators _potentialCreators
Since
2.18
_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.

_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

Method Detail

_addCreatorParamsback to summary
private void _addCreatorParams(Map<String, POJOPropertyBuilder> props, PotentialCreator ctor, List<POJOPropertyBuilder> creatorProps)
_addCreatorsback to summary
protected void _addCreators(Map<String, POJOPropertyBuilder> props)
_addCreatorsWithAnnotatedNamesback to summary
private void _addCreatorsWithAnnotatedNames(PotentialCreators collector, List<PotentialCreator> ctors, PotentialCreator primaryCtor)
_addExplicitlyAnnotatedCreatorsback to summary
private void _addExplicitlyAnnotatedCreators(PotentialCreators collector, List<PotentialCreator> ctors, Map<String, POJOPropertyBuilder> props, boolean skipPropsBased)
_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)
_addImplicitConstructorback to summary
private boolean _addImplicitConstructor(PotentialCreators collector, List<PotentialCreator> ctors, Map<String, POJOPropertyBuilder> props)
_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 accessor methods 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)
_collectCreatorsback to summary
private List<PotentialCreator> _collectCreators(List<? extends AnnotatedWithParams> ctors)
_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)
_findCreatorsWithAnnotatedNamesback to summary
private List<PotentialCreator> _findCreatorsWithAnnotatedNames(List<PotentialCreator> ctors)
_findNamingStrategyback to summary
private PropertyNamingStrategy _findNamingStrategy()
_isDelegatingConstructorback to summary
private boolean _isDelegatingConstructor(PotentialCreator ctor)
_isExplicitlyAnnotatedCreatorPropsBasedback to summary
private boolean _isExplicitlyAnnotatedCreatorPropsBased(PotentialCreator ctor, Map<String, POJOPropertyBuilder> props, ConstructorDetector ctorDetector)
_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)
_removeDisabledCreatorsback to summary
private void _removeDisabledCreators(List<PotentialCreator> ctors)
_removeNonFactoryStaticMethodsback to summary
private void _removeNonFactoryStaticMethods(List<PotentialCreator> ctors, PotentialCreator primaryCreator)
_removeNonVisibleCreatorsback to summary
private void _removeNonVisibleCreators(List<PotentialCreator> ctors)
_removeUnwantedAccessorsback to summary
protected void _removeUnwantedAccessors(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(List<POJOPropertyBuilder> creatorProperties, POJOPropertyBuilder prop)
_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)
collectAllback to summary
protected void collectAll()

Internal method that will collect actual property information.

Since
2.6
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()
getFormatOverridesback to summary
public JsonFormat.Value getFormatOverrides()
Since
2.17
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
getObjectIdInfoback to summary
public ObjectIdInfo getObjectIdInfo()

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

getPotentialCreatorsback to summary
public PotentialCreators getPotentialCreators()
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)