Class POJOPropertyBuilder
- java.lang.Object
-
- com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition
-
- com.fasterxml.jackson.databind.introspect.POJOPropertyBuilder
-
- All Implemented Interfaces:
Named
,java.lang.Comparable<POJOPropertyBuilder>
public class POJOPropertyBuilder extends BeanPropertyDefinition implements java.lang.Comparable<POJOPropertyBuilder>
Helper class used for aggregating information about a single potential POJO property.
-
-
Constructor Summary
Constructors Constructor Description POJOPropertyBuilder(MapperConfig<?> config, AnnotationIntrospector ai, boolean forSerialization, PropertyName internalName)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addAll(POJOPropertyBuilder src)
Method for adding all property members from specified collector into this collector.void
addCtor(AnnotatedParameter a, PropertyName name, boolean explName, boolean visible, boolean ignored)
void
addField(AnnotatedField a, PropertyName name, boolean explName, boolean visible, boolean ignored)
void
addGetter(AnnotatedMethod a, PropertyName name, boolean explName, boolean visible, boolean ignored)
void
addSetter(AnnotatedMethod a, PropertyName name, boolean explName, boolean visible, boolean ignored)
boolean
anyIgnorals()
boolean
anyVisible()
int
compareTo(POJOPropertyBuilder other)
boolean
couldDeserialize()
boolean
couldSerialize()
java.util.Collection<POJOPropertyBuilder>
explode(java.util.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.JsonProperty.Access
findAccess()
java.util.Set<PropertyName>
findExplicitNames()
Method called to find out set of explicit names for accessors bound together due to implicit name.JsonInclude.Value
findInclusion()
Method used to check if this property has specific inclusion override associated with it or not.ObjectIdInfo
findObjectIdInfo()
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.ReferenceProperty
findReferenceType()
Method used to find whether property is part of a bi-directional reference.java.lang.Class<?>[]
findViews()
Method used to find View-inclusion definitions for the property.AnnotatedParameter
getConstructorParameter()
java.util.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.AnnotatedField
getField()
PropertyName
getFullName()
AnnotatedMethod
getGetter()
java.lang.String
getInternalName()
Accessor that can be used to determine implicit name from underlying element(s) before possible renaming.PropertyMetadata
getMetadata()
Method for accessing additional metadata.java.lang.String
getName()
Accessor for name used for external representation (in JSON).AnnotatedMember
getPrimaryMember()
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.JavaType
getPrimaryType()
Type determined from the primary member for the property being built, considering precedence according to whether we are processing serialization or deserialization.java.lang.Class<?>
getRawPrimaryType()
AnnotatedMethod
getSetter()
PropertyName
getWrapperName()
Accessor for finding wrapper name to use for property (if any).boolean
hasConstructorParameter()
boolean
hasField()
boolean
hasGetter()
boolean
hasName(PropertyName name)
boolean
hasSetter()
boolean
isExplicitlyIncluded()
Accessor that can be called to check whether property was included due to an explicit marker (usually annotation), or just by naming convention.boolean
isExplicitlyNamed()
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).boolean
isTypeId()
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.void
mergeAnnotations(boolean forSerialization)
void
removeConstructors()
Mutator that will simply drop any constructor parameters property may have.void
removeIgnored()
Method called to remove all entries that are marked as ignored.JsonProperty.Access
removeNonVisible(boolean inferMutators)
Deprecated.JsonProperty.Access
removeNonVisible(boolean inferMutators, POJOPropertiesCollector parent)
java.lang.String
toString()
void
trimByVisibility()
Method called to trim unnecessary entries, such as implicit getter if there is an explict one available.POJOPropertyBuilder
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 whichBeanPropertyDefinition.getName()
would returnnewName
.POJOPropertyBuilder
withSimpleName(java.lang.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
-
-
-
-
Constructor Detail
-
POJOPropertyBuilder
public POJOPropertyBuilder(MapperConfig<?> config, AnnotationIntrospector ai, boolean forSerialization, PropertyName internalName)
-
-
Method Detail
-
withName
public POJOPropertyBuilder withName(PropertyName newName)
Description copied from class:BeanPropertyDefinition
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
.- Specified by:
withName
in classBeanPropertyDefinition
-
withSimpleName
public POJOPropertyBuilder withSimpleName(java.lang.String newSimpleName)
Description copied from class:BeanPropertyDefinition
Alternate "mutant factory" that will only change simple name, but leave other optional parts (like namespace) as is.- Specified by:
withSimpleName
in classBeanPropertyDefinition
-
compareTo
public int compareTo(POJOPropertyBuilder other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<POJOPropertyBuilder>
-
getName
public java.lang.String getName()
Description copied from class:BeanPropertyDefinition
Accessor for name used for external representation (in JSON).- Specified by:
getName
in interfaceNamed
- Specified by:
getName
in classBeanPropertyDefinition
-
getFullName
public PropertyName getFullName()
- Specified by:
getFullName
in classBeanPropertyDefinition
-
hasName
public boolean hasName(PropertyName name)
- Overrides:
hasName
in classBeanPropertyDefinition
-
getInternalName
public java.lang.String getInternalName()
Description copied from class:BeanPropertyDefinition
Accessor 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:
getInternalName
in classBeanPropertyDefinition
-
getWrapperName
public PropertyName getWrapperName()
Description copied from class:BeanPropertyDefinition
Accessor for finding wrapper name to use for property (if any).- Specified by:
getWrapperName
in classBeanPropertyDefinition
-
isExplicitlyIncluded
public boolean isExplicitlyIncluded()
Description copied from class:BeanPropertyDefinition
Accessor that can be called to check whether property was included due to an explicit marker (usually annotation), or just by naming convention.- Specified by:
isExplicitlyIncluded
in 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:BeanPropertyDefinition
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).Note that entries that return true from this method will always return true for
BeanPropertyDefinition.isExplicitlyIncluded()
, but not necessarily vice versa.- Overrides:
isExplicitlyNamed
in classBeanPropertyDefinition
-
getMetadata
public PropertyMetadata getMetadata()
Description copied from class:BeanPropertyDefinition
Method for accessing additional metadata. NOTE: will never return null, so de-referencing return value is safe.- Specified by:
getMetadata
in classBeanPropertyDefinition
-
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:
getPrimaryType
in classBeanPropertyDefinition
-
getRawPrimaryType
public java.lang.Class<?> getRawPrimaryType()
- Specified by:
getRawPrimaryType
in classBeanPropertyDefinition
-
hasGetter
public boolean hasGetter()
- Specified by:
hasGetter
in classBeanPropertyDefinition
-
hasSetter
public boolean hasSetter()
- Specified by:
hasSetter
in classBeanPropertyDefinition
-
hasField
public boolean hasField()
- Specified by:
hasField
in classBeanPropertyDefinition
-
hasConstructorParameter
public boolean hasConstructorParameter()
- Specified by:
hasConstructorParameter
in classBeanPropertyDefinition
-
couldDeserialize
public boolean couldDeserialize()
- Overrides:
couldDeserialize
in classBeanPropertyDefinition
-
couldSerialize
public boolean couldSerialize()
- Overrides:
couldSerialize
in classBeanPropertyDefinition
-
getGetter
public AnnotatedMethod getGetter()
- Specified by:
getGetter
in classBeanPropertyDefinition
-
getSetter
public AnnotatedMethod getSetter()
- Specified by:
getSetter
in classBeanPropertyDefinition
-
getField
public AnnotatedField getField()
- Specified by:
getField
in classBeanPropertyDefinition
-
getConstructorParameter
public AnnotatedParameter getConstructorParameter()
- Specified by:
getConstructorParameter
in classBeanPropertyDefinition
-
getConstructorParameters
public java.util.Iterator<AnnotatedParameter> getConstructorParameters()
Description copied from class:BeanPropertyDefinition
Additional method that may be called instead ofBeanPropertyDefinition.getConstructorParameter()
to get access to all constructor parameters, not just the highest priority one.- Overrides:
getConstructorParameters
in classBeanPropertyDefinition
-
getPrimaryMember
public AnnotatedMember getPrimaryMember()
Description copied from class:BeanPropertyDefinition
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.Note: may throw
IllegalArgumentException
in case problems are found trying to getter or setter info.Note: abstract since 2.5
- Specified by:
getPrimaryMember
in classBeanPropertyDefinition
-
findViews
public java.lang.Class<?>[] findViews()
Description copied from class:BeanPropertyDefinition
Method used to find View-inclusion definitions for the property.- Overrides:
findViews
in classBeanPropertyDefinition
-
findReferenceType
public AnnotationIntrospector.ReferenceProperty findReferenceType()
Description copied from class:BeanPropertyDefinition
Method used to find whether property is part of a bi-directional reference.- Overrides:
findReferenceType
in classBeanPropertyDefinition
-
isTypeId
public boolean isTypeId()
Description copied from class:BeanPropertyDefinition
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.- Overrides:
isTypeId
in classBeanPropertyDefinition
-
findObjectIdInfo
public ObjectIdInfo findObjectIdInfo()
Description copied from class:BeanPropertyDefinition
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).- Overrides:
findObjectIdInfo
in classBeanPropertyDefinition
-
findInclusion
public JsonInclude.Value findInclusion()
Description copied from class:BeanPropertyDefinition
Method 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:
findInclusion
in classBeanPropertyDefinition
-
findAccess
public 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
@Deprecated public JsonProperty.Access removeNonVisible(boolean inferMutators)
Deprecated.
-
removeNonVisible
public JsonProperty.Access removeNonVisible(boolean inferMutators, POJOPropertiesCollector parent)
- Parameters:
inferMutators
- Whether mutators can be "pulled in" by visible accessors or not.- 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
-
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 java.util.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 java.util.Collection<POJOPropertyBuilder> explode(java.util.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
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-