- All Implemented Interfaces:
Named,BeanProperty,FullyNamed
- Direct Known Subclasses:
CreatorProperty,MethodProperty,ObjectIdReferenceProperty,ObjectIdValueProperty,SettableBeanProperty.Delegating,SetterlessProperty
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classHelper class that is designed to both make it easier to sub-class delegating subtypes and to reduce likelihood of breakage when new methods are added.Nested classes/interfaces inherited from interface tools.jackson.databind.BeanProperty
BeanProperty.Bogus, BeanProperty.StdNested classes/interfaces inherited from interface tools.jackson.core.util.Named
Named.StringAsNamed -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AnnotationsClass that contains this property (either class that declares the property or one of its subclasses), class that is deserialized using deserializer that contains this property.protected StringIf property represents a managed (forward) reference, we will need the name of reference for later linking.protected final NullValueProviderEntity used for possible translation from `null` into non-null value of type of this property.protected ObjectIdInfoThis is the information for object identity associated with the property.protected intIndex of property (within all property of a bean); assigned when all properties have been collected.protected final PropertyNameLogical name of the property (often but not always derived from the setter method name)protected final JavaTypeBase type for property; may be a supertype of actual value.protected final ValueDeserializer<Object>Deserializer used for handling property value.protected final TypeDeserializerIf value will contain type information (to support polymorphic handling), this is the type deserializer used to handle type resolution.protected ViewMatcherHelper object used for checking whether this property is to be included in the active view, if property is view-specific; null otherwise.protected final PropertyNameprotected static final ValueDeserializer<Object>To avoid nasty NPEs, let's use a placeholder for _valueDeserializer, if real deserializer is not (yet) available.Fields inherited from class tools.jackson.databind.introspect.ConcreteBeanPropertyBase
_aliases, _metadataFields inherited from interface tools.jackson.databind.BeanProperty
EMPTY_FORMAT, EMPTY_INCLUDE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBasic copy-constructor for sub-classes to use.protectedSettableBeanProperty(SettableBeanProperty src, TypeDeserializer typeDeser) Copy-with-type-deserializer-change constructor for sub-classes to use.protectedSettableBeanProperty(SettableBeanProperty src, PropertyName newName) Copy-with-deserializer-change constructor for sub-classes to use.protectedSettableBeanProperty(SettableBeanProperty src, ValueDeserializer<?> deser, NullValueProvider nuller) Copy-with-deserializer-change constructor for sub-classes to use.protectedSettableBeanProperty(BeanPropertyDefinition propDef, JavaType type, TypeDeserializer typeDeser, Annotations contextAnnotations) protectedSettableBeanProperty(PropertyName propName, JavaType type, PropertyMetadata metadata, ValueDeserializer<Object> valueDeser) Constructor only used byObjectIdValueProperty.protectedSettableBeanProperty(PropertyName propName, JavaType type, PropertyName wrapper, TypeDeserializer typeDeser, Annotations contextAnnotations, PropertyMetadata metadata) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected void_throwAsJacksonE(JsonParser p, Throwable e, Object value) voidassignIndex(int index) Method used to assign index for property.voiddepositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializationContext provider) Method that can be called to visit the type structure that this property is part of.final Objectdeserialize(JsonParser p, DeserializationContext ctxt) This method is needed by some specialized bean deserializers, and also called by somedeserializeAndSet(tools.jackson.core.JsonParser, tools.jackson.databind.DeserializationContext, java.lang.Object)implementations.abstract voiddeserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) Method called to deserialize appropriate value, given parser (and context), and set it using appropriate mechanism.abstract ObjectdeserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) Alternative todeserializeAndSet(tools.jackson.core.JsonParser, tools.jackson.databind.DeserializationContext, java.lang.Object)that returns either return value of setter method called (if one is), or null to indicate that no return value is available.final ObjectdeserializeWith(JsonParser p, DeserializationContext ctxt, Object toUpdate) voidfixAccess(DeserializationConfig config) Method called to ensure that the mutator has proper access rights to be called, as per configuration.abstract <A extends Annotation>
AgetAnnotation(Class<A> acls) Method for finding annotation associated with this property; meaning annotation associated with one of entities used to access property.<A extends Annotation>
AgetContextAnnotation(Class<A> acls) Method for finding annotation associated with context of this property; usually class in which member is declared (or its subtype if processing subtype).intMethod for accessing index of the creator property: for other types of properties will simply return -1.Class<?>Accessor for id of injectable value, if this bean property supports value injection.abstract AnnotatedMemberMethod for accessing primary physical entity that represents the property; annotated field, method or constructor property.final StringgetName()intMethod for accessing unique index of this property; indexes are assigned once all properties of aBeanDeserializerhave been collected.getType()Method to get declared type of the property.If property is indicated to be wrapped, name of wrapper element to use.booleanbooleanbooleanhasViews()booleanbooleanAccessor for checking whether this property is injectable, and if so, ONLY injectable (will not bind from input).booleanWhether this property requires merging of values (read-then-write)voidabstract voidset(DeserializationContext ctxt, Object instance, Object value) Method called to assign given value to this property, on specified Object.abstract ObjectsetAndReturn(DeserializationContext ctxt, Object instance, Object value) Method called to assign given value to this property, on specified Object, and return whatever delegating accessor returned (if anything)voidvoidsetObjectIdInfo(ObjectIdInfo objectIdInfo) voidtoString()unwrapped(DeserializationContext ctxt, NameTransformer xf) Returns a copy of this property, unwrapped using givenNameTransformer.booleanvisibleInView(Class<?> activeView) abstract SettableBeanPropertywithName(PropertyName newName) Fluent factory method for constructing and returning a new instance with specified property name.abstract SettableBeanPropertywithSimpleName(String simpleName) abstract SettableBeanPropertywithValueDeserializer(ValueDeserializer<?> deser) Fluent factory method for constructing and returning a new instance with specified value deserializer.Methods inherited from class tools.jackson.databind.introspect.ConcreteBeanPropertyBase
findAliases, findFormatOverrides, findPropertyFormat, findPropertyInclusion, getMetadata, isRequired, isVirtualMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface tools.jackson.databind.util.FullyNamed
hasName
-
Field Details
-
MISSING_VALUE_DESERIALIZER
To avoid nasty NPEs, let's use a placeholder for _valueDeserializer, if real deserializer is not (yet) available. -
_propName
Logical name of the property (often but not always derived from the setter method name) -
_type
Base type for property; may be a supertype of actual value. -
_wrapperName
-
_contextAnnotations
Class that contains this property (either class that declares the property or one of its subclasses), class that is deserialized using deserializer that contains this property. -
_valueDeserializer
Deserializer used for handling property value. -
_valueTypeDeserializer
If value will contain type information (to support polymorphic handling), this is the type deserializer used to handle type resolution. -
_nullProvider
Entity used for possible translation from `null` into non-null value of type of this property. Often same as_valueDeserializer, but not always. -
_managedReferenceName
If property represents a managed (forward) reference, we will need the name of reference for later linking.TODO: should try to make immutable.
-
_objectIdInfo
This is the information for object identity associated with the property.TODO: should try to make immutable.
-
_viewMatcher
Helper object used for checking whether this property is to be included in the active view, if property is view-specific; null otherwise.TODO: should try to make immutable.
-
_propertyIndex
protected int _propertyIndexIndex of property (within all property of a bean); assigned when all properties have been collected. Order of entries is arbitrary, but once indexes are assigned they are not changed.TODO: should try to make immutable if at all possible
-
-
Constructor Details
-
SettableBeanProperty
protected SettableBeanProperty(BeanPropertyDefinition propDef, JavaType type, TypeDeserializer typeDeser, Annotations contextAnnotations) -
SettableBeanProperty
protected SettableBeanProperty(PropertyName propName, JavaType type, PropertyName wrapper, TypeDeserializer typeDeser, Annotations contextAnnotations, PropertyMetadata metadata) -
SettableBeanProperty
protected SettableBeanProperty(PropertyName propName, JavaType type, PropertyMetadata metadata, ValueDeserializer<Object> valueDeser) Constructor only used byObjectIdValueProperty. -
SettableBeanProperty
Basic copy-constructor for sub-classes to use. -
SettableBeanProperty
protected SettableBeanProperty(SettableBeanProperty src, ValueDeserializer<?> deser, NullValueProvider nuller) Copy-with-deserializer-change constructor for sub-classes to use. -
SettableBeanProperty
Copy-with-deserializer-change constructor for sub-classes to use. -
SettableBeanProperty
Copy-with-type-deserializer-change constructor for sub-classes to use.
-
-
Method Details
-
withValueDeserializer
Fluent factory method for constructing and returning a new instance with specified value deserializer. Note that this method should NOT change configuration of this instance.- Parameters:
deser- Deserializer to assign to the new property instance- Returns:
- Newly constructed instance, if value deserializer differs from the one used for this instance; or 'this' if not.
-
withName
Fluent factory method for constructing and returning a new instance with specified property name. Note that this method should NOT change configuration of this instance.- Parameters:
newName- Name to use for the new instance.- Returns:
- Newly constructed instance, if property name differs from the one used for this instance; or 'this' if not.
-
withSimpleName
-
withNullProvider
-
setManagedReferenceName
-
setObjectIdInfo
-
setViews
-
assignIndex
public void assignIndex(int index) Method used to assign index for property. -
fixAccess
Method called to ensure that the mutator has proper access rights to be called, as per configuration. Overridden by implementations that have mutators that require access, fields and setters. -
markAsIgnorable
public void markAsIgnorable() -
isIgnorable
public boolean isIgnorable() -
isMerging
public boolean isMerging()Whether this property requires merging of values (read-then-write)- Since:
- 2.20
-
getName
-
getFullName
-
getType
Description copied from interface:BeanPropertyMethod to get declared type of the property. -
getWrapperName
Description copied from interface:BeanPropertyIf property is indicated to be wrapped, name of wrapper element to use. -
getMember
Description copied from interface:BeanPropertyMethod for accessing primary physical entity that represents the property; annotated field, method or constructor property. -
getAnnotation
Description copied from interface:BeanPropertyMethod for finding annotation associated with this property; meaning annotation associated with one of entities used to access property.Note that this method should only be called for custom annotations; access to standard Jackson annotations (or ones supported by alternate
AnnotationIntrospectors) should be accessed throughAnnotationIntrospector. -
getContextAnnotation
Description copied from interface:BeanPropertyMethod for finding annotation associated with context of this property; usually class in which member is declared (or its subtype if processing subtype).Note that this method should only be called for custom annotations; access to standard Jackson annotations (or ones supported by alternate
AnnotationIntrospectors) should be accessed throughAnnotationIntrospector. -
depositSchemaProperty
public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializationContext provider) Description copied from interface:BeanPropertyMethod that can be called to visit the type structure that this property is part of. Note that not all implementations support traversal with this method; those that do not should throwUnsupportedOperationException.- Parameters:
objectVisitor- Visitor to used as the callback handler
-
getDeclaringClass
-
getManagedReferenceName
-
getObjectIdInfo
-
hasValueDeserializer
public boolean hasValueDeserializer() -
hasValueTypeDeserializer
public boolean hasValueTypeDeserializer() -
getValueDeserializer
-
getValueTypeDeserializer
-
getNullValueProvider
-
visibleInView
-
hasViews
public boolean hasViews() -
getPropertyIndex
public int getPropertyIndex()Method for accessing unique index of this property; indexes are assigned once all properties of aBeanDeserializerhave been collected.- Returns:
- Index of this property
-
getCreatorIndex
public int getCreatorIndex()Method for accessing index of the creator property: for other types of properties will simply return -1. -
getInjectableValueId
Accessor for id of injectable value, if this bean property supports value injection. -
isInjectionOnly
public boolean isInjectionOnly()Accessor for checking whether this property is injectable, and if so, ONLY injectable (will not bind from input). Currently (2.11) can only returntruefor Creator-backed properties.- Returns:
- True if (and only if) property has injector that is also defined NOT to bind from input.
-
deserializeAndSet
public abstract void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws JacksonException Method called to deserialize appropriate value, given parser (and context), and set it using appropriate mechanism. Pre-condition is that passed parser must point to the first token that should be consumed to produce the value (the only value for scalars, multiple for Objects and Arrays).- Throws:
JacksonException
-
deserializeSetAndReturn
public abstract Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws JacksonException Alternative todeserializeAndSet(tools.jackson.core.JsonParser, tools.jackson.databind.DeserializationContext, java.lang.Object)that returns either return value of setter method called (if one is), or null to indicate that no return value is available. Mostly used to support Builder style deserialization.- Throws:
JacksonException
-
set
Method called to assign given value to this property, on specified Object.Note: this is an optional operation, not supported by all implementations, creator-backed properties for example do not support this method.
-
setAndReturn
Method called to assign given value to this property, on specified Object, and return whatever delegating accessor returned (if anything)Note: this is an optional operation, not supported by all implementations, creator-backed properties for example do not support this method.
-
deserialize
This method is needed by some specialized bean deserializers, and also called by somedeserializeAndSet(tools.jackson.core.JsonParser, tools.jackson.databind.DeserializationContext, java.lang.Object)implementations.Pre-condition is that passed parser must point to the first token that should be consumed to produce the value (the only value for scalars, multiple for Objects and Arrays).
Note that this method is final for performance reasons: to override functionality you must override other methods that call this method; this method should also not be called directly unless you really know what you are doing (and probably not even then).
- Throws:
JacksonException
-
deserializeWith
public final Object deserializeWith(JsonParser p, DeserializationContext ctxt, Object toUpdate) throws JacksonException - Throws:
JacksonException
-
unwrapped
Returns a copy of this property, unwrapped using givenNameTransformer.- Since:
- 2.19
-
_throwAsJacksonE
- Throws:
JacksonException
-
_throwAsJacksonE
- Throws:
JacksonException
-
toString
-