Class POJOPropertyBuilder
- java.lang.Object
-
- com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition
-
- com.fasterxml.jackson.databind.introspect.POJOPropertyBuilder
-
- All Implemented Interfaces:
Named,Comparable<POJOPropertyBuilder>
public class POJOPropertyBuilder extends BeanPropertyDefinition implements Comparable<POJOPropertyBuilder>
Helper class used for aggregating information about a single potential POJO property.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classPOJOPropertyBuilder.Linked<T>Node used for creating simple linked lists to efficiently store small sets of things.protected static classPOJOPropertyBuilder.MemberIterator<T extends AnnotatedMember>
-
Field Summary
Fields Modifier and Type Field Description protected AnnotationIntrospector_annotationIntrospectorprotected MapperConfig<?>_configprotected POJOPropertyBuilder.Linked<AnnotatedParameter>_ctorParametersprotected POJOPropertyBuilder.Linked<AnnotatedField>_fieldsprotected boolean_forSerializationWhether property is being composed for serialization (true) or deserialization (false)protected POJOPropertyBuilder.Linked<AnnotatedMethod>_gettersprotected PropertyName_internalNameOriginal internal name, derived from accessor, of this property.protected PropertyMetadata_metadataprotected PropertyName_nameExternal name of logical property; may change with renaming (by new instance being constructed using a new name)protected AnnotationIntrospector.ReferenceProperty_referenceInfoLazily accessed information about this property iff it is a forward or back reference.protected POJOPropertyBuilder.Linked<AnnotatedMethod>_setters-
Fields inherited from class com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition
EMPTY_INCLUDE
-
-
Constructor Summary
Constructors Modifier Constructor Description POJOPropertyBuilder(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String_findDefaultValue()protected String_findDescription()protected Integer_findIndex()protected Boolean_findRequired()protected PropertyMetadata_getSetterInfo(PropertyMetadata metadata)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 int_getterPriority(AnnotatedMethod m)protected int_setterPriority(AnnotatedMethod m)voidaddAll(POJOPropertyBuilder src)Method 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)booleananyIgnorals()booleananyVisible()intcompareTo(POJOPropertyBuilder other)booleancouldDeserialize()booleancouldSerialize()Collection<POJOPropertyBuilder>explode(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.com.fasterxml.jackson.annotation.JsonProperty.AccessfindAccess()Set<PropertyName>findExplicitNames()Method called to find out set of explicit names for accessors bound together due to implicit name.com.fasterxml.jackson.annotation.JsonInclude.ValuefindInclusion()Method used to check if this property has specific inclusion override associated with it or not.ObjectIdInfofindObjectIdInfo()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).AnnotationIntrospector.ReferencePropertyfindReferenceType()Method used to find whether property is part of a bi-directional reference.Class<?>[]findViews()Method used to find View-inclusion definitions for the property.protected <T> TfromMemberAnnotations(com.fasterxml.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(com.fasterxml.jackson.databind.introspect.POJOPropertyBuilder.WithMember<T> func, T defaultValue)AnnotatedParametergetConstructorParameter()Iterator<AnnotatedParameter>getConstructorParameters()Additional method that may be called instead ofBeanPropertyDefinition.getConstructorParameter()to get access to all constructor parameters, not just the highest priority one.AnnotatedFieldgetField()PropertyNamegetFullName()AnnotatedMethodgetGetter()StringgetInternalName()Accessor that can be used to determine implicit name from underlying element(s) before possible renaming.PropertyMetadatagetMetadata()Method for accessing additional metadata.StringgetName()Accessor for name used for external representation (in JSON).AnnotatedMembergetPrimaryMember()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.JavaTypegetPrimaryType()Type determined from the primary member for the property being built, considering precedence according to whether we are processing serialization or deserialization.Class<?>getRawPrimaryType()AnnotatedMethodgetSetter()PropertyNamegetWrapperName()Accessor for finding wrapper name to use for property (if any).booleanhasConstructorParameter()booleanhasField()booleanhasGetter()booleanhasName(PropertyName name)booleanhasSetter()booleanisExplicitlyIncluded()Accessor that can be called to check whether property was included due to an explicit marker (usually annotation), or just by naming convention.booleanisExplicitlyNamed()Accessor 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)voidremoveConstructors()Mutator that will simply drop any constructor parameters property may have.voidremoveIgnored()Method called to remove all entries that are marked as ignored.com.fasterxml.jackson.annotation.JsonProperty.AccessremoveNonVisible(boolean inferMutators)StringtoString()voidtrimByVisibility()Method called to trim unnecessary entries, such as implicit getter if there is an explict one available.POJOPropertyBuilderwithName(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 whichBeanPropertyDefinition.getName()would returnnewName.POJOPropertyBuilderwithSimpleName(String newSimpleName)Alternate "mutant factory" that will only change simple name, but leave other optional parts (like namespace) as is.-
Methods inherited from class com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition
findReferenceName, getAccessor, getMutator, getNonConstructorMutator, isRequired
-
-
-
-
Field Detail
-
_forSerialization
protected final boolean _forSerialization
Whether property is being composed for serialization (true) or deserialization (false)
-
_config
protected final MapperConfig<?> _config
-
_annotationIntrospector
protected final AnnotationIntrospector _annotationIntrospector
-
_name
protected final PropertyName _name
External name of logical property; may change with renaming (by new instance being constructed using a new name)
-
_internalName
protected final PropertyName _internalName
Original internal name, derived from accessor, of this property. Will not be changed by renaming.
-
_fields
protected POJOPropertyBuilder.Linked<AnnotatedField> _fields
-
_ctorParameters
protected POJOPropertyBuilder.Linked<AnnotatedParameter> _ctorParameters
-
_getters
protected POJOPropertyBuilder.Linked<AnnotatedMethod> _getters
-
_setters
protected POJOPropertyBuilder.Linked<AnnotatedMethod> _setters
-
_metadata
protected transient PropertyMetadata _metadata
-
_referenceInfo
protected transient AnnotationIntrospector.ReferenceProperty _referenceInfo
Lazily accessed information about this property iff it is a forward or back reference.- Since:
- 2.9
-
-
Constructor Detail
-
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
protected POJOPropertyBuilder(POJOPropertyBuilder src, PropertyName newName)
-
-
Method Detail
-
withName
public POJOPropertyBuilder withName(PropertyName newName)
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 whichBeanPropertyDefinition.getName()would returnnewName.- Specified by:
withNamein classBeanPropertyDefinition
-
withSimpleName
public POJOPropertyBuilder withSimpleName(String newSimpleName)
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
public int compareTo(POJOPropertyBuilder other)
- Specified by:
compareToin interfaceComparable<POJOPropertyBuilder>
-
getName
public String getName()
Description copied from class:BeanPropertyDefinitionAccessor for name used for external representation (in JSON).- Specified by:
getNamein interfaceNamed- Specified by:
getNamein classBeanPropertyDefinition
-
getFullName
public PropertyName getFullName()
- Specified by:
getFullNamein classBeanPropertyDefinition
-
hasName
public boolean hasName(PropertyName name)
- Overrides:
hasNamein classBeanPropertyDefinition
-
getInternalName
public String 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
public PropertyName 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
public PropertyMetadata 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
protected PropertyMetadata _getSetterInfo(PropertyMetadata metadata)
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.
-
getPrimaryType
public JavaType 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
public Class<?> 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
-
hasConstructorParameter
public boolean hasConstructorParameter()
- Specified by:
hasConstructorParameterin classBeanPropertyDefinition
-
couldDeserialize
public boolean couldDeserialize()
- Overrides:
couldDeserializein classBeanPropertyDefinition
-
couldSerialize
public boolean couldSerialize()
- Overrides:
couldSerializein classBeanPropertyDefinition
-
getGetter
public AnnotatedMethod getGetter()
- Specified by:
getGetterin classBeanPropertyDefinition
-
getSetter
public AnnotatedMethod getSetter()
- Specified by:
getSetterin classBeanPropertyDefinition
-
getField
public AnnotatedField getField()
- Specified by:
getFieldin classBeanPropertyDefinition
-
getConstructorParameter
public AnnotatedParameter getConstructorParameter()
- Specified by:
getConstructorParameterin classBeanPropertyDefinition
-
getConstructorParameters
public Iterator<AnnotatedParameter> 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
public AnnotatedMember 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: abstract since 2.5
- Specified by:
getPrimaryMemberin classBeanPropertyDefinition
-
_getterPriority
protected int _getterPriority(AnnotatedMethod m)
-
_setterPriority
protected int _setterPriority(AnnotatedMethod m)
-
findViews
public Class<?>[] findViews()
Description copied from class:BeanPropertyDefinitionMethod used to find View-inclusion definitions for the property.- Overrides:
findViewsin classBeanPropertyDefinition
-
findReferenceType
public AnnotationIntrospector.ReferenceProperty 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
-
_findRequired
protected Boolean _findRequired()
-
_findDescription
protected String _findDescription()
-
_findIndex
protected Integer _findIndex()
-
_findDefaultValue
protected String _findDefaultValue()
-
findObjectIdInfo
public ObjectIdInfo 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
public com.fasterxml.jackson.annotation.JsonInclude.Value 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
-
findAccess
public com.fasterxml.jackson.annotation.JsonProperty.Access 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
public void addAll(POJOPropertyBuilder src)
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
public com.fasterxml.jackson.annotation.JsonProperty.Access removeNonVisible(boolean inferMutators)
- Parameters:
inferMutators- Whether mutators can be "pulled in" by visible accessors or not.
-
removeConstructors
public void removeConstructors()
Mutator that will simply drop any constructor parameters property may have.- Since:
- 2.5
-
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()
-
findExplicitNames
public Set<PropertyName> findExplicitNames()
Method called to find out set of explicit names for accessors bound together due to implicit name.- Since:
- 2.4
-
explode
public Collection<POJOPropertyBuilder> explode(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.- Since:
- 2.4
-
fromMemberAnnotations
protected <T> T fromMemberAnnotations(com.fasterxml.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(com.fasterxml.jackson.databind.introspect.POJOPropertyBuilder.WithMember<T> func, T defaultValue)
-
-