Class BeanPropertyDefinition
- java.lang.Object
-
- com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition
-
- All Implemented Interfaces:
Named
- Direct Known Subclasses:
POJOPropertyBuilder,SimpleBeanPropertyDefinition
public abstract class BeanPropertyDefinition extends java.lang.Object implements Named
Simple value classes that contain definitions of properties, used during introspection of properties to use for serialization and deserialization purposes. These instances are created before actualBeanPropertyinstances are created, i.e. they are used earlier in the process flow, and are typically used to construct actualBeanPropertyinstances.
-
-
Constructor Summary
Constructors Constructor Description BeanPropertyDefinition()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancouldDeserialize()booleancouldSerialize()java.util.List<PropertyName>findAliases()Method for finding all aliases of the property, if any.abstract 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).java.lang.StringfindReferenceName()AnnotationIntrospector.ReferencePropertyfindReferenceType()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.AnnotatedMembergetAccessor()Method used to find accessor (getter, field to access) to use for accessing value of the property.abstract AnnotatedParametergetConstructorParameter()java.util.Iterator<AnnotatedParameter>getConstructorParameters()Additional method that may be called instead ofgetConstructorParameter()to get access to all constructor parameters, not just the highest priority one.abstract AnnotatedFieldgetField()abstract PropertyNamegetFullName()abstract AnnotatedMethodgetGetter()abstract java.lang.StringgetInternalName()Accessor that can be used to determine implicit name from underlying element(s) before possible renaming.abstract PropertyMetadatagetMetadata()Method for accessing additional metadata.AnnotatedMembergetMutator()Method used to find mutator (constructor parameter, setter, field) to use for changing value of the property.abstract java.lang.StringgetName()Accessor for name used for external representation (in JSON).AnnotatedMembergetNonConstructorMutator()abstract 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.abstract JavaTypegetPrimaryType()abstract java.lang.Class<?>getRawPrimaryType()abstract AnnotatedMethodgetSetter()abstract PropertyNamegetWrapperName()Accessor for finding wrapper name to use for property (if any).abstract booleanhasConstructorParameter()abstract booleanhasField()abstract booleanhasGetter()booleanhasName(PropertyName name)abstract booleanhasSetter()abstract 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).booleanisRequired()Method used to check if this property is expected to have a value; and if none found, should either be considered invalid (and most likely fail deserialization), or handled by other means (by providing default value)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.abstract BeanPropertyDefinitionwithName(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 whichgetName()would returnnewName.abstract BeanPropertyDefinitionwithSimpleName(java.lang.String newSimpleName)Alternate "mutant factory" that will only change simple name, but leave other optional parts (like namespace) as is.
-
-
-
Method Detail
-
withName
public abstract BeanPropertyDefinition 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 whichgetName()would returnnewName.- Since:
- 2.3
-
withSimpleName
public abstract BeanPropertyDefinition withSimpleName(java.lang.String newSimpleName)
Alternate "mutant factory" that will only change simple name, but leave other optional parts (like namespace) as is.- Since:
- 2.3
-
getName
public abstract java.lang.String getName()
Accessor for name used for external representation (in JSON).
-
getFullName
public abstract PropertyName getFullName()
-
hasName
public boolean hasName(PropertyName name)
- Since:
- 2.6
-
getInternalName
public abstract java.lang.String getInternalName()
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.
-
getWrapperName
public abstract PropertyName getWrapperName()
Accessor for finding wrapper name to use for property (if any).- Since:
- 2.2
-
isExplicitlyIncluded
public abstract 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.- 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()
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
isExplicitlyIncluded(), but not necessarily vice versa.- Since:
- 2.4
-
getPrimaryType
public abstract JavaType getPrimaryType()
- Since:
- 2.9
-
getRawPrimaryType
public abstract java.lang.Class<?> getRawPrimaryType()
- Since:
- 2.9
-
getMetadata
public abstract PropertyMetadata getMetadata()
Method for accessing additional metadata. NOTE: will never return null, so de-referencing return value is safe.- Since:
- 2.3
-
isRequired
public boolean isRequired()
Method used to check if this property is expected to have a value; and if none found, should either be considered invalid (and most likely fail deserialization), or handled by other means (by providing default value)
-
couldDeserialize
public boolean couldDeserialize()
-
couldSerialize
public boolean couldSerialize()
-
hasGetter
public abstract boolean hasGetter()
-
hasSetter
public abstract boolean hasSetter()
-
hasField
public abstract boolean hasField()
-
hasConstructorParameter
public abstract boolean hasConstructorParameter()
-
getGetter
public abstract AnnotatedMethod getGetter()
-
getSetter
public abstract AnnotatedMethod getSetter()
-
getField
public abstract AnnotatedField getField()
-
getConstructorParameter
public abstract AnnotatedParameter getConstructorParameter()
-
getConstructorParameters
public java.util.Iterator<AnnotatedParameter> getConstructorParameters()
Additional method that may be called instead ofgetConstructorParameter()to get access to all constructor parameters, not just the highest priority one.- Since:
- 2.5
-
getAccessor
public AnnotatedMember getAccessor()
Method used to find accessor (getter, field to access) to use for accessing value of the property. Null if no such member exists.
-
getMutator
public AnnotatedMember getMutator()
Method used to find mutator (constructor parameter, setter, field) to use for changing value of the property. Null if no such member exists.
-
getNonConstructorMutator
public AnnotatedMember getNonConstructorMutator()
- Since:
- 2.3
-
getPrimaryMember
public abstract 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.Note: may throw
IllegalArgumentExceptionin case problems are found trying to getter or setter info.Note: abstract since 2.5
- Since:
- 2.1
-
findViews
public java.lang.Class<?>[] findViews()
Method used to find View-inclusion definitions for the property.
-
findReferenceType
public AnnotationIntrospector.ReferenceProperty findReferenceType()
Method used to find whether property is part of a bi-directional reference.
-
findReferenceName
public java.lang.String findReferenceName()
- Since:
- 2.9
-
isTypeId
public 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.
-
findObjectIdInfo
public 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).
-
findInclusion
public abstract JsonInclude.Value findInclusion()
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)- Since:
- 2.5
-
findAliases
public java.util.List<PropertyName> findAliases()
Method for finding all aliases of the property, if any.- Returns:
Listof aliases, if any; never null (empty list if no aliases found)- Since:
- 2.17
-
-