Class POJOPropertiesCollector
-
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)Class-level ignorals: direction-specific names derived from@JsonIgnoreProperties(annotation plus config overrides), copied here from_propertyIgnoralsduring_collectClassLevelIgnorals().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 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)protected 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 withJsonValueSnapshot of_perPropertyIgnoredNamestaken just before the[databind#2001]creator-rename rescue can fire, used bygetNonRescuedIgnoredPropertyNames().Per-property ignorals: names collected from@JsonIgnoremarkers and read/write-only access rules via_collectIgnorals(java.lang.String).protected PotentialCreatorsprotected LinkedHashMap<String,POJOPropertyBuilder> Set of logical property information collected so far.protected JsonIgnoreProperties.ValueClass-level ignorals (annotation plus config overrides), computed once during_collectClassLevelIgnorals()and exposed to the factory layer viagetPropertyIgnorals()so thatfindPropertyIgnoralByName()is called exactly once per type.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 TypeMethodDescriptionprotected void_addCreators(Map<String, POJOPropertyBuilder> props) protected void_addFields(Map<String, POJOPropertyBuilder> props) Method for collecting basic information on all fields foundprotected void_addGetterMethod(Map<String, POJOPropertyBuilder> props, AnnotatedMethod m) 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) protected voidHelper method called to collect class-level property ignorals: stores the fullJsonIgnoreProperties.Value(annotation + config overrides) in_propertyIgnoralsfor reuse by the factory layer, and copies the direction-specific property names into_classLevelIgnoredNames(held separately from_perPropertyIgnoredNamesso the[databind#2001]creator-rename rescue does not strip them — class-level ignorals are absolute).protected void_collectIgnorals(String name) Helper method called to record a per-property ignoral (from@JsonIgnoreor read/write-only rules) into_perPropertyIgnoredNames.protected void_doAddInjectable(JacksonInject.Value injectable, AnnotatedMember m) protected voidprotected POJOPropertyBuilder_property(Map<String, POJOPropertyBuilder> props, String implName) protected POJOPropertyBuilder_property(Map<String, POJOPropertyBuilder> props, PropertyName name) protected 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 voidprotected void_renameUsing(Map<String, POJOPropertyBuilder> propMap, PropertyNamingStrategy naming) protected voidprotected boolean_replaceCreatorProperty(List<POJOPropertyBuilder> creatorProperties, POJOPropertyBuilder prop) protected voidRemoves from_perPropertyIgnoredNamesany name that is a@JsonAliasof a (live) properties-based creator parameter.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<?>Deprecated.Since 3.2Accessor for the full set of property names marked ignored — combining per-property@JsonIgnoremarkers, class-level@JsonIgnoreProperties, and read/write-only access rules.Accessor for the per-property ignorals view before any[databind#2001]creator-rename rescue is applied: includes every per-property@JsonIgnoreor read/write-only name that was originally collected, even those later overridden by a creator parameter renamed to the same name.Accessor to find out whether type specified requires inclusion of Object Identifier.Accessor for class-level property ignorals (annotation plus config overrides), computed once during collection and cached for reuse by the factory layer.protected Map<String,POJOPropertyBuilder> getType()booleanReturnstrueif the (already-collected) properties-based creator has a parameter currently bound to the given name.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 -
_perPropertyIgnoredNames
Per-property ignorals: names collected from@JsonIgnoremarkers and read/write-only access rules via_collectIgnorals(java.lang.String).Kept as a mutable set because
_renameProperties(java.util.Map<java.lang.String, tools.jackson.databind.introspect.POJOPropertyBuilder>)may remove entries for[databind#2001]when a per-property ignoral is overridden by a creator parameter renamed to the same name. The pre-rescue state is captured into_nonRescuedIgnoredPropertyNameson the first such removal sogetNonRescuedIgnoredPropertyNames()can still report it. Class-level ignorals are tracked in_classLevelIgnoredNamesinstead so they remain immune to that rescue. -
_classLevelIgnoredNames
Class-level ignorals: direction-specific names derived from@JsonIgnoreProperties(annotation plus config overrides), copied here from_propertyIgnoralsduring_collectClassLevelIgnorals().Held separately from
_perPropertyIgnoredNamesso that the[databind#2001]creator-rename rescue does not strip them: class-level ignorals are absolute, per-property ignorals can be overridden by creators.- Since:
- 3.2
-
_nonRescuedIgnoredPropertyNames
Snapshot of_perPropertyIgnoredNamestaken just before the[databind#2001]creator-rename rescue can fire, used bygetNonRescuedIgnoredPropertyNames(). Null when no rescue happened (in which case_perPropertyIgnoredNamesitself is still complete).- Since:
- 3.2
-
_propertyIgnorals
Class-level ignorals (annotation plus config overrides), computed once during_collectClassLevelIgnorals()and exposed to the factory layer viagetPropertyIgnorals()so thatfindPropertyIgnoralByName()is called exactly once per type.The direction-specific name set carried here is also mirrored into
_classLevelIgnoredNamesfor inclusion ingetIgnoredPropertyNames(); this field additionally retains theignoreUnknown,allowGetters/allowSetters, andmergeattributes which the simple name set does not. -
_injectables
Lazily collected list of members that were annotated to indicate that they represent mutators for deserializer value injection. -
_formatOverrides
Lazily 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
Accessor for the full set of property names marked ignored — combining per-property@JsonIgnoremarkers, class-level@JsonIgnoreProperties, and read/write-only access rules. Filtered by direction (ser vs. deser) at collection time.Per-property names that have been "rescued" by the
[databind#2001]creator-rename redirect are excluded from this set; class-level names are not subject to that rescue and always appear here. This is the set factory code should consult to populate a deserializer's runtime ignore-list (seeBeanDeserializerFactory#addBeanProps). For the un-rescued per-property view seegetNonRescuedIgnoredPropertyNames().Performance note: when both per-property and class-level ignorals exist, this allocates a fresh
HashSeton every call to merge them. Callers that reference the result repeatedly (or in a loop) should cache the returned set in a local. The intended call-site isBeanDeserializerFactory#addBeanProps, which runs once per type during deserializer construction — not on the dispatch hot path. -
getNonRescuedIgnoredPropertyNames
Accessor for the per-property ignorals view before any[databind#2001]creator-rename rescue is applied: includes every per-property@JsonIgnoreor read/write-only name that was originally collected, even those later overridden by a creator parameter renamed to the same name. Class-level@JsonIgnorePropertiesnames are also included (they are never rescued in the first place).Most callers should use
getIgnoredPropertyNames()instead — this accessor exists for the rare case where a caller needs to know about names that would have been ignored but for the rescue.- Since:
- 3.2
-
getPropertyIgnorals
Accessor for class-level property ignorals (annotation plus config overrides), computed once during collection and cached for reuse by the factory layer. Returnsnullwhen no ignorals are defined.Carries only class-level ignorals, in their original (un-stripped) form. Equivalent to the class-level subset of
getIgnoredPropertyNames(), but inJsonIgnoreProperties.Valueform (which also carriesignoreUnknown,allowGetters/allowSetters, etc.). -
getObjectIdInfo
Accessor to find out whether type specified requires inclusion of Object Identifier. -
getPropertyMap
-
getFormatOverrides
Deprecated.Since 3.2- Since:
- 2.17
-
collectAll
protected void collectAll()Internal method that will collect actual property information. -
_addFields
Method for collecting basic information on all fields found -
_addCreators
-
_addMethods
Method for collecting basic information on all accessor methods found -
_addGetterMethod
-
_addSetterMethod
-
_addInjectables
-
_doAddInjectable
-
_fixLeadingFieldNameCase
-
_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 record a per-property ignoral (from@JsonIgnoreor read/write-only rules) into_perPropertyIgnoredNames. Used by_renameProperties(java.util.Map<java.lang.String, tools.jackson.databind.introspect.POJOPropertyBuilder>)to skip renaming ignored properties, and surfaced externally viagetIgnoredPropertyNames(). -
hasCreatorBoundProperty
Returnstrueif the (already-collected) properties-based creator has a parameter currently bound to the given name. Used byPOJOPropertyBuilder.removeNonVisible(boolean, tools.jackson.databind.introspect.POJOPropertiesCollector)to skipREAD_ONLYexplicit-name ignorals that would shadow a sibling creator parameter ([databind#5975]).- Since:
- 3.2
-
_collectClassLevelIgnorals
protected void _collectClassLevelIgnorals()Helper method called to collect class-level property ignorals: stores the fullJsonIgnoreProperties.Value(annotation + config overrides) in_propertyIgnoralsfor reuse by the factory layer, and copies the direction-specific property names into_classLevelIgnoredNames(held separately from_perPropertyIgnoredNamesso the[databind#2001]creator-rename rescue does not strip them — class-level ignorals are absolute).Uses
MapperConfig.getDefaultPropertyIgnorals(java.lang.Class<?>)rather than callingfindPropertyIgnoralByName()directly, so that config-level overrides are included and consistent with what the factory layer sees.- Since:
- 3.2
-
_renameProperties
-
_rescueCreatorAliasIgnorals
protected void _rescueCreatorAliasIgnorals()Removes from_perPropertyIgnoredNamesany name that is a@JsonAliasof a (live) properties-based creator parameter. Companion to the[databind#2001]creator-rename rescue in_renameProperties(java.util.Map<java.lang.String, tools.jackson.databind.introspect.POJOPropertyBuilder>); see[databind#6031].- Since:
- 3.2.1
-
_renameUsing
-
_renameWithWrappers
-
_sortProperties
-
_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
-
_replaceCreatorProperty
protected boolean _replaceCreatorProperty(List<POJOPropertyBuilder> creatorProperties, POJOPropertyBuilder prop)
-