java.lang.Object
tools.jackson.databind.introspect.BeanPropertyDefinition
tools.jackson.databind.introspect.POJOPropertyBuilder
- All Implemented Interfaces:
Comparable<POJOPropertyBuilder>,Named,FullyNamed
public class POJOPropertyBuilder
extends BeanPropertyDefinition
implements Comparable<POJOPropertyBuilder>
Helper class used for aggregating information about a single
potential POJO property.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classNode used for creating simple linked lists to efficiently store small sets of things.protected static classNested classes/interfaces inherited from interface tools.jackson.core.util.Named
Named.StringAsNamed -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AnnotationIntrospectorprotected final MapperConfig<?>protected POJOPropertyBuilder.Linked<AnnotatedParameter>protected POJOPropertyBuilder.Linked<AnnotatedField>protected final booleanWhether property is being composed for serialization (true) or deserialization (false)protected POJOPropertyBuilder.Linked<AnnotatedMethod>protected final PropertyNameOriginal internal name, derived from accessor, of this property.protected PropertyMetadataprotected final PropertyNameExternal name of logical property; may change with renaming (by new instance being constructed using a new name)protected AnnotationIntrospector.ReferencePropertyLazily accessed information about this property iff it is a forward or back reference.protected POJOPropertyBuilder.Linked<AnnotatedMethod>Fields inherited from class tools.jackson.databind.introspect.BeanPropertyDefinition
EMPTY_INCLUDE -
Constructor Summary
ConstructorsModifierConstructorDescriptionPOJOPropertyBuilder(MapperConfig<?> config, AnnotationIntrospector ai, boolean forSerialization, PropertyName internalName) protectedPOJOPropertyBuilder(MapperConfig<?> config, AnnotationIntrospector ai, boolean forSerialization, PropertyName internalName, PropertyName name) protectedPOJOPropertyBuilder(POJOPropertyBuilder src, PropertyName newName) -
Method Summary
Modifier and TypeMethodDescriptionprotected PropertyMetadata_getSetterInfo(PropertyMetadata metadata, AnnotatedMember primary) Helper method that contains logic for accessing and merging all setter information that we needed, regarding things like possible merging of property value, and handling of incoming nulls.protected intprotected Class<?>protected AnnotatedMethod_selectSetter(AnnotatedMethod currM, AnnotatedMethod nextM) protected AnnotatedMethod_selectSetterFromMultiple(POJOPropertyBuilder.Linked<AnnotatedMethod> curr, POJOPropertyBuilder.Linked<AnnotatedMethod> next) Helper method called in cases where we have encountered two setter methods that have same precedence and cannot be resolved.protected intvoidMethod for adding all property members from specified collector into this collector.voidaddCtor(AnnotatedParameter a, PropertyName name, boolean explName, boolean visible, boolean ignored) voidaddField(AnnotatedField a, PropertyName name, boolean explName, boolean visible, boolean ignored) voidaddGetter(AnnotatedMethod a, PropertyName name, boolean explName, boolean visible, boolean ignored) voidaddSetter(AnnotatedMethod a, PropertyName name, boolean explName, boolean visible, boolean ignored) booleanbooleanbooleanintcompareTo(POJOPropertyBuilder other) booleanbooleanexplode(Collection<PropertyName> newNames) Method called when a previous call tofindExplicitNames()found multiple distinct explicit names, and the property this builder represents basically needs to be broken apart and replaced by a set of more than one properties.Method for finding all aliases of the property, if any.Method called to find out set of explicit names for accessors bound together due to implicit name.Method used to check if this property has specific inclusion override associated with it or not.Method used to check whether this logical property indicates that value POJOs should be written using additional Object Identifier (or, when multiple references exist, all but first AS Object Identifier).Method used to find whether property is part of a bi-directional reference.Class<?>[]Method used to find View-inclusion definitions for the property.protected <T> TfromMemberAnnotations(tools.jackson.databind.introspect.POJOPropertyBuilder.WithMember<T> func) Helper method used for finding annotation values, from accessors relevant to current usage (deserialization, serialization)protected <T> TfromMemberAnnotationsExcept(tools.jackson.databind.introspect.POJOPropertyBuilder.WithMember<T> func, T defaultValue) Additional method that may be called instead ofBeanPropertyDefinition.getConstructorParameter()to get access to all constructor parameters, not just the highest priority one.getField()protected AnnotatedFieldVariant ofgetField()that does NOT trigger pruning of Field candidates.protected AnnotatedMethodVariant ofgetGetter()that does NOT trigger pruning of getter candidates.Accessor that can be used to determine implicit name from underlying element(s) before possible renaming.Method for accessing additional metadata.getName()Method used to find the property member (getter, setter, field) that has the highest precedence in current context (getter method when serializing, if available, and so forth), if any.protected AnnotatedMemberType determined from the primary member for the property being built, considering precedence according to whether we are processing serialization or deserialization.Class<?>protected AnnotatedMethodVariant ofgetSetter()that does NOT trigger pruning of setter candidates.Accessor for finding wrapper name to use for property (if any).booleanbooleanhasExplicitName(PropertyName name) Method find out if this property has specified explicit name: this is generally needed for properties that have not yet been renamed (Creator-detection).booleanhasField()booleanbooleanhasFieldOrGetter(AnnotatedMember member) booleanbooleanhasName(PropertyName name) booleanbooleanAccessor that can be called to check whether property was included due to an explicit marker (usually annotation), or just by naming convention.booleanAccessor that can be called to check whether property name was due to an explicit marker (usually annotation), or just by naming convention or use of "use-default-name" marker (annotation).booleanisTypeId()Method used to check whether this logical property has a marker to indicate it should be used as the type id for polymorphic type handling.voidmergeAnnotations(boolean forSerialization) voidMutator that will simply drop any constructor parameters property may have.voidMutator that will simply drop any fields property may have.voidMethod called to remove all entries that are marked as ignored.removeNonVisible(boolean inferMutators, POJOPropertiesCollector parent) toString()voidMethod called to trim unnecessary entries, such as implicit getter if there is an explict one available.withName(PropertyName newName) Method that can be used to create a definition with same settings as this one, but with different (external) name; that is, one for whichNamed.getName()would returnnewName.withSimpleName(String newSimpleName) Alternate "mutant factory" that will only change simple name, but leave other optional parts (like namespace) as is.Methods inherited from class tools.jackson.databind.introspect.BeanPropertyDefinition
findReferenceName, getAccessor, getMutator, getNonConstructorMutator, isRequired
-
Field Details
-
_forSerialization
protected final boolean _forSerializationWhether property is being composed for serialization (true) or deserialization (false) -
_config
-
_annotationIntrospector
-
_name
External name of logical property; may change with renaming (by new instance being constructed using a new name) -
_internalName
Original internal name, derived from accessor, of this property. Will not be changed by renaming. -
_fields
-
_ctorParameters
-
_getters
-
_setters
-
_metadata
-
_referenceInfo
Lazily accessed information about this property iff it is a forward or back reference.- Since:
- 2.9
-
-
Constructor Details
-
POJOPropertyBuilder
public POJOPropertyBuilder(MapperConfig<?> config, AnnotationIntrospector ai, boolean forSerialization, PropertyName internalName) -
POJOPropertyBuilder
protected POJOPropertyBuilder(MapperConfig<?> config, AnnotationIntrospector ai, boolean forSerialization, PropertyName internalName, PropertyName name) -
POJOPropertyBuilder
-
-
Method Details
-
withName
Description copied from class:BeanPropertyDefinitionMethod that can be used to create a definition with same settings as this one, but with different (external) name; that is, one for whichNamed.getName()would returnnewName.- Specified by:
withNamein classBeanPropertyDefinition
-
withSimpleName
Description copied from class:BeanPropertyDefinitionAlternate "mutant factory" that will only change simple name, but leave other optional parts (like namespace) as is.- Specified by:
withSimpleNamein classBeanPropertyDefinition
-
compareTo
- Specified by:
compareToin interfaceComparable<POJOPropertyBuilder>
-
getName
-
getFullName
- Specified by:
getFullNamein interfaceFullyNamed
-
hasName
- Specified by:
hasNamein interfaceFullyNamed
-
getInternalName
Description copied from class:BeanPropertyDefinitionAccessor that can be used to determine implicit name from underlying element(s) before possible renaming. This is the "internal" name derived from accessor ("x" from "getX"), and is not based on annotations or naming strategy.- Specified by:
getInternalNamein classBeanPropertyDefinition
-
getWrapperName
Description copied from class:BeanPropertyDefinitionAccessor for finding wrapper name to use for property (if any).- Specified by:
getWrapperNamein classBeanPropertyDefinition
-
isExplicitlyIncluded
public boolean isExplicitlyIncluded()Description copied from class:BeanPropertyDefinitionAccessor that can be called to check whether property was included due to an explicit marker (usually annotation), or just by naming convention.- Specified by:
isExplicitlyIncludedin classBeanPropertyDefinition- Returns:
- True if property was explicitly included (usually by having one of components being annotated); false if inclusion was purely due to naming or visibility definitions (that is, implicit)
-
isExplicitlyNamed
public boolean isExplicitlyNamed()Description copied from class:BeanPropertyDefinitionAccessor that can be called to check whether property name was due to an explicit marker (usually annotation), or just by naming convention or use of "use-default-name" marker (annotation).Note that entries that return true from this method will always return true for
BeanPropertyDefinition.isExplicitlyIncluded(), but not necessarily vice versa.- Overrides:
isExplicitlyNamedin classBeanPropertyDefinition
-
getMetadata
Description copied from class:BeanPropertyDefinitionMethod for accessing additional metadata. NOTE: will never return null, so de-referencing return value is safe.- Specified by:
getMetadatain classBeanPropertyDefinition
-
_getSetterInfo
Helper method that contains logic for accessing and merging all setter information that we needed, regarding things like possible merging of property value, and handling of incoming nulls. Only called for deserialization purposes. -
getPrimaryType
Type determined from the primary member for the property being built, considering precedence according to whether we are processing serialization or deserialization.- Specified by:
getPrimaryTypein classBeanPropertyDefinition
-
getRawPrimaryType
- Specified by:
getRawPrimaryTypein classBeanPropertyDefinition
-
hasGetter
public boolean hasGetter()- Specified by:
hasGetterin classBeanPropertyDefinition
-
hasSetter
public boolean hasSetter()- Specified by:
hasSetterin classBeanPropertyDefinition
-
hasField
public boolean hasField()- Specified by:
hasFieldin classBeanPropertyDefinition
-
hasFieldAndNothingElse
public boolean hasFieldAndNothingElse() -
hasConstructorParameter
public boolean hasConstructorParameter()- Specified by:
hasConstructorParameterin classBeanPropertyDefinition
-
couldDeserialize
public boolean couldDeserialize()- Overrides:
couldDeserializein classBeanPropertyDefinition
-
couldSerialize
public boolean couldSerialize()- Overrides:
couldSerializein classBeanPropertyDefinition
-
getGetter
- Specified by:
getGetterin classBeanPropertyDefinition
-
getGetterUnchecked
Variant ofgetGetter()that does NOT trigger pruning of getter candidates. -
getSetter
- Specified by:
getSetterin classBeanPropertyDefinition
-
getSetterUnchecked
Variant ofgetSetter()that does NOT trigger pruning of setter candidates. -
_selectSetterFromMultiple
protected AnnotatedMethod _selectSetterFromMultiple(POJOPropertyBuilder.Linked<AnnotatedMethod> curr, POJOPropertyBuilder.Linked<AnnotatedMethod> next) Helper method called in cases where we have encountered two setter methods that have same precedence and cannot be resolved. This does not yet necessarily mean a failure since it is possible something with a higher precedence could still be found; handling is just separated into separate method for convenience.- Parameters:
curr-next-- Returns:
- Chosen setter method, if any
- Throws:
IllegalArgumentException- If conflict could not be resolved- Since:
- 2.13
-
_selectSetter
-
getField
- Specified by:
getFieldin classBeanPropertyDefinition
-
getFieldUnchecked
Variant ofgetField()that does NOT trigger pruning of Field candidates. -
getConstructorParameter
- Specified by:
getConstructorParameterin classBeanPropertyDefinition
-
getConstructorParameters
Description copied from class:BeanPropertyDefinitionAdditional method that may be called instead ofBeanPropertyDefinition.getConstructorParameter()to get access to all constructor parameters, not just the highest priority one.- Overrides:
getConstructorParametersin classBeanPropertyDefinition
-
getPrimaryMember
Description copied from class:BeanPropertyDefinitionMethod used to find the property member (getter, setter, field) that has the highest precedence in current context (getter method when serializing, if available, and so forth), if any.Note: may throw
IllegalArgumentExceptionin case problems are found trying to getter or setter info.Note: abstract since 2.5
- Specified by:
getPrimaryMemberin classBeanPropertyDefinition
-
getPrimaryMemberUnchecked
-
_getterPriority
-
_setterPriority
-
hasFieldOrGetter
-
findViews
Description copied from class:BeanPropertyDefinitionMethod used to find View-inclusion definitions for the property.- Overrides:
findViewsin classBeanPropertyDefinition
-
findReferenceType
Description copied from class:BeanPropertyDefinitionMethod used to find whether property is part of a bi-directional reference.- Overrides:
findReferenceTypein classBeanPropertyDefinition
-
isTypeId
public boolean isTypeId()Description copied from class:BeanPropertyDefinitionMethod used to check whether this logical property has a marker to indicate it should be used as the type id for polymorphic type handling.- Overrides:
isTypeIdin classBeanPropertyDefinition
-
findObjectIdInfo
Description copied from class:BeanPropertyDefinitionMethod used to check whether this logical property indicates that value POJOs should be written using additional Object Identifier (or, when multiple references exist, all but first AS Object Identifier).- Overrides:
findObjectIdInfoin classBeanPropertyDefinition
-
findInclusion
Description copied from class:BeanPropertyDefinitionMethod used to check if this property has specific inclusion override associated with it or not. It should NOT check for any default settings (global, per-type, or containing POJO settings)- Specified by:
findInclusionin classBeanPropertyDefinition
-
findAliases
Description copied from class:BeanPropertyDefinitionMethod for finding all aliases of the property, if any.- Specified by:
findAliasesin classBeanPropertyDefinition- Returns:
Listof aliases, if any; never null (empty list if no aliases found)
-
findAccess
-
addField
public void addField(AnnotatedField a, PropertyName name, boolean explName, boolean visible, boolean ignored) -
addCtor
public void addCtor(AnnotatedParameter a, PropertyName name, boolean explName, boolean visible, boolean ignored) -
addGetter
public void addGetter(AnnotatedMethod a, PropertyName name, boolean explName, boolean visible, boolean ignored) -
addSetter
public void addSetter(AnnotatedMethod a, PropertyName name, boolean explName, boolean visible, boolean ignored) -
addAll
Method for adding all property members from specified collector into this collector. -
removeIgnored
public void removeIgnored()Method called to remove all entries that are marked as ignored. -
removeNonVisible
- Parameters:
inferMutators- Whether mutators can be "pulled in" by visible accessors or not.parent- (nullable) Collector to add name ignorals to, if that is desired.- Since:
- 2.12 (earlier had different signature)
-
removeConstructors
public void removeConstructors()Mutator that will simply drop any constructor parameters property may have.- Since:
- 2.5
-
removeFields
public void removeFields()Mutator that will simply drop any fields property may have.- Since:
- 2.18
-
trimByVisibility
public void trimByVisibility()Method called to trim unnecessary entries, such as implicit getter if there is an explict one available. This is important for later stages, to avoid unnecessary conflicts. -
mergeAnnotations
public void mergeAnnotations(boolean forSerialization) -
anyVisible
public boolean anyVisible() -
anyIgnorals
public boolean anyIgnorals() -
anyExplicitsWithoutIgnoral
public boolean anyExplicitsWithoutIgnoral() -
findExplicitNames
Method called to find out set of explicit names for accessors bound together due to implicit name.- Since:
- 2.4
-
hasExplicitName
Method find out if this property has specified explicit name: this is generally needed for properties that have not yet been renamed (Creator-detection).- Parameters:
name- Name to check against- Returns:
- True if this property has specified explicit name
- Since:
- 2.18.2
-
explode
Method called when a previous call tofindExplicitNames()found multiple distinct explicit names, and the property this builder represents basically needs to be broken apart and replaced by a set of more than one properties.- Since:
- 2.4
-
toString
-
fromMemberAnnotations
protected <T> T fromMemberAnnotations(tools.jackson.databind.introspect.POJOPropertyBuilder.WithMember<T> func) Helper method used for finding annotation values, from accessors relevant to current usage (deserialization, serialization) -
fromMemberAnnotationsExcept
protected <T> T fromMemberAnnotationsExcept(tools.jackson.databind.introspect.POJOPropertyBuilder.WithMember<T> func, T defaultValue) -
_rawTypeOf
-