Module tools.jackson.databind
Package tools.jackson.databind.util
Class SimpleBeanPropertyDefinition
java.lang.Object
tools.jackson.databind.introspect.BeanPropertyDefinition
tools.jackson.databind.util.SimpleBeanPropertyDefinition
- All Implemented Interfaces:
Named,FullyNamed
Simple immutable
BeanPropertyDefinition implementation that can
be wrapped around a AnnotatedMember that is a simple
accessor (getter) or mutator (setter, constructor parameter)
(or both, for fields).-
Nested Class Summary
Nested classes/interfaces inherited from interface tools.jackson.core.util.Named
Named.StringAsNamed -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final MapperConfig<?>protected final PropertyNameprotected final JsonInclude.Valueprotected final AnnotatedMemberMember that defines logical property.protected final PropertyMetadataFields inherited from class tools.jackson.databind.introspect.BeanPropertyDefinition
EMPTY_INCLUDE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSimpleBeanPropertyDefinition(MapperConfig<?> config, AnnotatedMember member, PropertyName fullName, PropertyMetadata metadata, JsonInclude.Value inclusion) -
Method Summary
Modifier and TypeMethodDescriptionstatic SimpleBeanPropertyDefinitionconstruct(MapperConfig<?> config, AnnotatedMember member) static SimpleBeanPropertyDefinitionconstruct(MapperConfig<?> config, AnnotatedMember member, PropertyName name) static SimpleBeanPropertyDefinitionconstruct(MapperConfig<?> config, AnnotatedMember member, PropertyName name, PropertyMetadata metadata, JsonInclude.Include inclusion) Method called to create instance for virtual properties.static SimpleBeanPropertyDefinitionconstruct(MapperConfig<?> config, AnnotatedMember member, PropertyName name, PropertyMetadata metadata, JsonInclude.Value inclusion) Method for finding all aliases of the property, if any.Method used to check if this property has specific inclusion override associated with it or not.Additional method that may be called instead ofBeanPropertyDefinition.getConstructorParameter()to get access to all constructor parameters, not just the highest priority one.getField()Accessor that can be used to determine implicit name from underlying element(s) before possible renaming.We will indicate that property is optional, since there is nothing to indicate whether it might be required.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.Class<?>Accessor for finding wrapper name to use for property (if any).booleanbooleanhasField()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).withInclusion(JsonInclude.Value inclusion) withMetadata(PropertyMetadata metadata) 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 newName) 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
couldDeserialize, couldSerialize, findObjectIdInfo, findReferenceName, findReferenceType, findViews, getAccessor, getMutator, getNonConstructorMutator, isRequired, isTypeId
-
Field Details
-
_config
-
_member
Member that defines logical property. Assumption is that it should be a 'simple' accessor; meaning a zero-argument getter, single-argument setter or constructor parameter.NOTE: for "virtual" properties, this is null.
-
_metadata
-
_fullName
-
_inclusion
-
-
Constructor Details
-
SimpleBeanPropertyDefinition
protected SimpleBeanPropertyDefinition(MapperConfig<?> config, AnnotatedMember member, PropertyName fullName, PropertyMetadata metadata, JsonInclude.Value inclusion)
-
-
Method Details
-
construct
public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config, AnnotatedMember member) -
construct
public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config, AnnotatedMember member, PropertyName name) -
construct
public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config, AnnotatedMember member, PropertyName name, PropertyMetadata metadata, JsonInclude.Include inclusion) Method called to create instance for virtual properties. -
construct
public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config, AnnotatedMember member, PropertyName name, PropertyMetadata metadata, JsonInclude.Value inclusion) - Since:
- 2.7
-
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
-
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
-
withMetadata
- Since:
- 2.5
-
withInclusion
- Since:
- 2.5
-
getName
-
getFullName
-
hasName
-
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
We will indicate that property is optional, since there is nothing to indicate whether it might be required.- Specified by:
getMetadatain classBeanPropertyDefinition
-
getPrimaryType
- Specified by:
getPrimaryTypein classBeanPropertyDefinition
-
getRawPrimaryType
- Specified by:
getRawPrimaryTypein 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)
-
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
-
getGetter
- Specified by:
getGetterin classBeanPropertyDefinition
-
getSetter
- Specified by:
getSetterin classBeanPropertyDefinition
-
getField
- Specified by:
getFieldin classBeanPropertyDefinition
-
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
-