Class POJOPropertiesCollector
java.lang.Object
tools.jackson.databind.introspect.POJOPropertiesCollector
Helper class used for aggregating information about all possible
properties of a POJO.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AccessorNamingStrategyHandler used for name-mangling of getter, mutator (setter/with) methodsprotected final AnnotationIntrospectorprotected LinkedList<AnnotatedMember> protected LinkedList<AnnotatedMember> protected LinkedList<AnnotatedMember> protected LinkedList<AnnotatedMethod> protected final AnnotatedClassLow-level introspected class information (methods, fields etc)protected booleanState flag we keep to indicate whether actual property information has been collected or not.protected final MapperConfig<?> Configuration settingsprotected List<POJOPropertyBuilder> protected Map<PropertyName, PropertyName> 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 com.fasterxml.jackson.annotation.JsonFormat.ValueLazily accessed information about POJO format overridesprotected final booleanTrue if introspection is done for serialization (giving precedence for serialization annotations), or not (false, deserialization)Lazily collected list of properties that can be implicitly ignored during serialization; only updated when collecting information for deserialization purposesprotected LinkedHashMap<Object, AnnotatedMember> Lazily collected list of members that were annotated to indicate that they represent mutators for deserializer value injection.protected final booleanprotected LinkedList<AnnotatedMember> Accessors (field or "getter" method annotated withJsonKeyprotected LinkedList<AnnotatedMember> Accessors (field or "getter" method) annotated withJsonValueprotected PotentialCreatorsprotected LinkedHashMap<String, POJOPropertyBuilder> Set of logical property information collected so far.protected final JavaTypeType of POJO for which properties are being collected.protected final booleanprotected final VisibilityChecker -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPOJOPropertiesCollector(MapperConfig<?> config, boolean forSerialization, JavaType type, AnnotatedClass classDef, AccessorNamingStrategy accessorNaming) -
Method Summary
Modifier and TypeMethodDescriptionprivate void_addCreatorParams(Map<String, POJOPropertyBuilder> props, PotentialCreator ctor, List<POJOPropertyBuilder> creatorProps) protected void_addCreators(Map<String, POJOPropertyBuilder> props) private void_addCreatorsWithAnnotatedNames(PotentialCreators collector, List<PotentialCreator> ctors, PotentialCreator primaryCtor) private void_addExplicitlyAnnotatedCreators(PotentialCreators collector, List<PotentialCreator> ctors, Map<String, POJOPropertyBuilder> props, boolean skipPropsBased) protected void_addFields(Map<String, POJOPropertyBuilder> props) Method for collecting basic information on all fields foundprotected void_addGetterMethod(Map<String, POJOPropertyBuilder> props, AnnotatedMethod m) private boolean_addImplicitConstructor(PotentialCreators collector, List<PotentialCreator> ctors, Map<String, POJOPropertyBuilder> props) protected void_addInjectables(Map<String, POJOPropertyBuilder> props) protected void_addMethods(Map<String, POJOPropertyBuilder> props) Method for collecting basic information on all accessor methods foundprotected void_addSetterMethod(Map<String, POJOPropertyBuilder> props, AnnotatedMethod m) private boolean_anyIndexed(Collection<POJOPropertyBuilder> props) private String_checkRenameByField(String implName) private List<PotentialCreator> _collectCreators(List<? extends AnnotatedWithParams> ctors) 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_doAddInjectable(com.fasterxml.jackson.annotation.JacksonInject.Value injectable, AnnotatedMember m) private List<PotentialCreator> private com.fasterxml.jackson.annotation.JsonFormat.ShapeHelper method called to check if given property should be renamed usingPropertyNamingStrategies.private PropertyNamingStrategyprivate booleanprotected voidprivate booleanprivate booleanprivate boolean_isExplicitlyAnnotatedCreatorPropsBased(PotentialCreator ctor, Map<String, POJOPropertyBuilder> props, ConstructorDetector ctorDetector) private PotentialCreatorprotected POJOPropertyBuilder_property(Map<String, POJOPropertyBuilder> props, String implName) protected POJOPropertyBuilder_property(Map<String, POJOPropertyBuilder> props, PropertyName name) private PropertyName_propNameFromSimple(String simpleName) private Map<String, POJOPropertyBuilder> _putAnyGettersInTheEnd(Map<String, POJOPropertyBuilder> sortedProps) [databind#5215] JsonAnyGetter Serializer behavior change from 2.18.4 to 2.19.0 Put anyGetter in the end, before actual sorting further down_sortProperties(Map)private voidprivate void_removeNonFactoryStaticMethods(List<PotentialCreator> ctors, PotentialCreator primaryCreator) private voidprotected voidMethod called to further get rid of unwanted individual accessors, based on read/write settings and rules for "pulling in" accessors (or not).protected voidMethod called to get rid of candidate properties that are marked as ignored.protected void_renameProperties(Map<String, POJOPropertyBuilder> props) protected void_renameUsing(Map<String, POJOPropertyBuilder> propMap, PropertyNamingStrategy naming) protected void_renameWithWrappers(Map<String, POJOPropertyBuilder> props) protected boolean_replaceCreatorProperty(List<POJOPropertyBuilder> creatorProperties, POJOPropertyBuilder prop) protected boolean_resolveFieldVsGetter(List<AnnotatedMember> accessors) Method that will be given aListwith 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_sortProperties(Map<String, POJOPropertyBuilder> props) protected voidInternal method that will collect actual property information.MapperConfig<?> com.fasterxml.jackson.annotation.JsonFormat.ValueAccessor for set of properties that are explicitly marked to be ignored via per-property markers (but NOT class annotations).Accessor to find out whether type specified requires inclusion of Object Identifier.protected Map<String, POJOPropertyBuilder> getType()booleanprotected voidreportProblem(String msg, Object... args)
-
Field Details
-
_config
Configuration settings -
_accessorNaming
Handler used for name-mangling of getter, mutator (setter/with) methods -
_forSerialization
protected final boolean _forSerializationTrue if introspection is done for serialization (giving precedence for serialization annotations), or not (false, deserialization) -
_type
Type of POJO for which properties are being collected. -
_classDef
Low-level introspected class information (methods, fields etc) -
_visibilityChecker
-
_annotationIntrospector
-
_useAnnotations
protected final boolean _useAnnotations -
_isRecordType
protected final boolean _isRecordType -
_collected
protected boolean _collectedState flag we keep to indicate whether actual property information has been collected or not. -
_properties
Set of logical property information collected so far. -
_creatorProperties
-
_potentialCreators
- Since:
- 2.18
-
_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.
-
_anyGetters
-
_anyGetterField
-
_anySetters
-
_anySetterField
-
_jsonKeyAccessors
Accessors (field or "getter" method annotated withJsonKey -
_jsonValueAccessors
Accessors (field or "getter" method) annotated withJsonValue -
_ignoredPropertyNames
-
_injectables
Lazily collected list of members that were annotated to indicate that they represent mutators for deserializer value injection. -
_formatOverrides
protected com.fasterxml.jackson.annotation.JsonFormat.Value _formatOverridesLazily accessed information about POJO format overrides
-
-
Constructor Details
-
POJOPropertiesCollector
protected POJOPropertiesCollector(MapperConfig<?> config, boolean forSerialization, JavaType type, AnnotatedClass classDef, AccessorNamingStrategy accessorNaming)
-
-
Method Details
-
getConfig
-
getType
-
isRecordType
public boolean isRecordType() -
getClassDef
-
getAnnotationIntrospector
-
getProperties
-
getPotentialCreators
-
getInjectables
-
getJsonKeyAccessor
-
getJsonValueAccessor
-
getAnyGetterField
-
getAnyGetterMethod
-
getAnySetterField
-
getAnySetterMethod
-
getIgnoredPropertyNames
-
getObjectIdInfo
Accessor to find out whether type specified requires inclusion of Object Identifier. -
getPropertyMap
-
getFormatOverrides
public com.fasterxml.jackson.annotation.JsonFormat.Value getFormatOverrides()- Since:
- 2.17
-
collectAll
protected void collectAll()Internal method that will collect actual property information. -
_putAnyGettersInTheEnd
private Map<String, POJOPropertyBuilder> _putAnyGettersInTheEnd(Map<String, POJOPropertyBuilder> sortedProps) [databind#5215] JsonAnyGetter Serializer behavior change from 2.18.4 to 2.19.0 Put anyGetter in the end, before actual sorting further down_sortProperties(Map) -
_addFields
Method for collecting basic information on all fields found -
_addCreators
-
_isDelegatingConstructor
-
_collectCreators
-
_potentialCreator
-
_removeDisabledCreators
-
_isDisabledCreator
-
_removeNonVisibleCreators
-
_removeNonFactoryStaticMethods
private void _removeNonFactoryStaticMethods(List<PotentialCreator> ctors, PotentialCreator primaryCreator) -
_addExplicitlyAnnotatedCreators
private void _addExplicitlyAnnotatedCreators(PotentialCreators collector, List<PotentialCreator> ctors, Map<String, POJOPropertyBuilder> props, boolean skipPropsBased) -
_isExplicitlyAnnotatedCreatorPropsBased
private boolean _isExplicitlyAnnotatedCreatorPropsBased(PotentialCreator ctor, Map<String, POJOPropertyBuilder> props, ConstructorDetector ctorDetector) -
_addCreatorsWithAnnotatedNames
private void _addCreatorsWithAnnotatedNames(PotentialCreators collector, List<PotentialCreator> ctors, PotentialCreator primaryCtor) -
_findCreatorsWithAnnotatedNames
-
_addImplicitConstructor
private boolean _addImplicitConstructor(PotentialCreators collector, List<PotentialCreator> ctors, Map<String, POJOPropertyBuilder> props) -
_addCreatorParams
private void _addCreatorParams(Map<String, POJOPropertyBuilder> props, PotentialCreator ctor, List<POJOPropertyBuilder> creatorProps) -
_addMethods
Method for collecting basic information on all accessor methods found -
_addGetterMethod
-
_addSetterMethod
-
_addInjectables
-
_doAddInjectable
protected void _doAddInjectable(com.fasterxml.jackson.annotation.JacksonInject.Value injectable, AnnotatedMember m) -
_propNameFromSimple
-
_checkRenameByField
-
_fixLeadingFieldNameCase
-
_firstOrSecondCharUpperCase
-
_removeUnwantedProperties
Method called to get rid of candidate properties that are marked as ignored. -
_removeUnwantedAccessors
Method called to further get rid of unwanted individual accessors, based on read/write settings and rules for "pulling in" accessors (or not). -
_collectIgnorals
Helper method called to add explicitly ignored properties to a list of known ignored properties; this helps in proper reporting of errors. -
_renameProperties
-
_renameUsing
protected void _renameUsing(Map<String, POJOPropertyBuilder> propMap, PropertyNamingStrategy naming) -
_findFormatShape
private com.fasterxml.jackson.annotation.JsonFormat.Shape _findFormatShape()Helper method called to check if given property should be renamed usingPropertyNamingStrategies.NOTE: copied+simplified version of
BasicBeanDescription.findExpectedFormat().- Since:
- 2.16.2
-
_renameWithWrappers
-
_sortProperties
-
_anyIndexed
-
_resolveFieldVsGetter
Method that will be given aListwith 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 returnstrue, otherwisefalse.NOTE: method will directly modify given
Listdirectly, regardless of whether it ultimately succeeds or not.- Returns:
- True if seeming conflict was resolved and there only remains single accessor
-
reportProblem
-
_property
-
_property
-
_findNamingStrategy
-
_replaceCreatorProperty
protected boolean _replaceCreatorProperty(List<POJOPropertyBuilder> creatorProperties, POJOPropertyBuilder prop)
-