public class BeanPropertyWriter extends PropertyWriter implements java.io.Serializable
Note that current design tries to keep instances immutable (semi-functional style); mostly because these instances are exposed to application code and this is to reduce likelihood of data corruption and synchronization issues.
BeanProperty.Bogus, BeanProperty.Std
Modifier and Type | Field and Description |
---|---|
static java.lang.Object |
MARKER_FOR_EMPTY
Marker object used to indicate "do not serialize if empty"
|
EMPTY_FORMAT, EMPTY_INCLUDE
Constructor and Description |
---|
BeanPropertyWriter(BeanPropertyDefinition propDef,
AnnotatedMember member,
Annotations contextAnnotations,
JavaType declaredType,
JsonSerializer<?> ser,
TypeSerializer typeSer,
JavaType serType,
boolean suppressNulls,
java.lang.Object suppressableValue)
Deprecated.
|
BeanPropertyWriter(BeanPropertyDefinition propDef,
AnnotatedMember member,
Annotations contextAnnotations,
JavaType declaredType,
JsonSerializer<?> ser,
TypeSerializer typeSer,
JavaType serType,
boolean suppressNulls,
java.lang.Object suppressableValue,
java.lang.Class<?>[] includeInViews) |
Modifier and Type | Method and Description |
---|---|
void |
assignNullSerializer(JsonSerializer<java.lang.Object> nullSer)
Method called to assign null value serializer for property
|
void |
assignSerializer(JsonSerializer<java.lang.Object> ser)
Method called to assign value serializer for property
|
void |
assignTypeSerializer(TypeSerializer typeSer)
Method called to set, reset or clear the configured type serializer for
property.
|
void |
depositSchemaProperty(JsonObjectFormatVisitor v,
SerializerProvider provider)
Traversal method used for things like JSON Schema generation, or
POJO introspection.
|
void |
depositSchemaProperty(ObjectNode propertiesNode,
SerializerProvider provider)
Deprecated.
|
void |
fixAccess(SerializationConfig config)
Method called to ensure that the mutator has proper access rights to
be called, as per configuration.
|
java.lang.Object |
get(java.lang.Object bean)
Method that can be used to access value of the property this Object
describes, from given bean instance.
|
<A extends java.lang.annotation.Annotation> |
getAnnotation(java.lang.Class<A> acls)
Method for accessing annotations directly declared for property that this
writer is associated with.
|
<A extends java.lang.annotation.Annotation> |
getContextAnnotation(java.lang.Class<A> acls)
Method for accessing annotations declared in context of the property that this
writer is associated with; usually this means annotations on enclosing class
for property.
|
PropertyName |
getFullName()
Method for getting full name definition, including possible
format-specific additional properties (such as namespace when
using XML backend).
|
java.lang.reflect.Type |
getGenericPropertyType()
Deprecated.
Since 2.7, to be removed from 2.9, use
getType() instead. |
java.lang.Object |
getInternalSetting(java.lang.Object key)
Method for accessing value of specified internal setting.
|
AnnotatedMember |
getMember()
Method for accessing primary physical entity that represents the property;
annotated field, method or constructor property.
|
java.lang.String |
getName()
Method to get logical name of the property
|
java.lang.Class<?> |
getPropertyType()
Deprecated.
Since 2.7, to be removed from 2.9, use
getType() instead. |
java.lang.Class<?> |
getRawSerializationType()
Deprecated.
|
JavaType |
getSerializationType() |
SerializableString |
getSerializedName() |
JsonSerializer<java.lang.Object> |
getSerializer() |
JavaType |
getType()
Method to get declared type of the property.
|
TypeSerializer |
getTypeSerializer() |
java.lang.Class<?>[] |
getViews() |
PropertyName |
getWrapperName()
If property is indicated to be wrapped, name of
wrapper element to use.
|
boolean |
hasNullSerializer() |
boolean |
hasSerializer() |
boolean |
isUnwrapping()
Accessor that will return true if this bean property has to support
"unwrapping"; ability to replace POJO structural wrapping with optional
name prefix and/or suffix (or in some cases, just removal of wrapper
name).
|
java.lang.Object |
removeInternalSetting(java.lang.Object key)
Method for removing entry for specified internal setting.
|
BeanPropertyWriter |
rename(NameTransformer transformer) |
void |
serializeAsElement(java.lang.Object bean,
JsonGenerator gen,
SerializerProvider prov)
Alternative to
serializeAsField(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider) that is used when a POJO is
serialized as JSON Array; the difference is that no field names are
written. |
void |
serializeAsField(java.lang.Object bean,
JsonGenerator gen,
SerializerProvider prov)
Method called to access property that this bean stands for, from within
given bean, and to serialize it as a JSON Object field using appropriate
serializer.
|
void |
serializeAsOmittedField(java.lang.Object bean,
JsonGenerator gen,
SerializerProvider prov)
Method called to indicate that serialization of a field was omitted due
to filtering, in cases where backend data format does not allow basic
omission.
|
void |
serializeAsPlaceholder(java.lang.Object bean,
JsonGenerator gen,
SerializerProvider prov)
Method called to serialize a placeholder used in tabular output when real
value is not to be included (is filtered out), but when we need an entry
so that field indexes will not be off.
|
java.lang.Object |
setInternalSetting(java.lang.Object key,
java.lang.Object value)
Method for setting specific internal setting to given value
|
void |
setNonTrivialBaseType(JavaType t)
Method called to define type to consider as "non-trivial" basetype,
needed for dynamic serialization resolution for complex (usually
container) types
|
java.lang.String |
toString() |
BeanPropertyWriter |
unwrappingWriter(NameTransformer unwrapper)
Method called create an instance that handles details of unwrapping
contained value.
|
boolean |
willSuppressNulls() |
boolean |
wouldConflictWithName(PropertyName name)
Method called to check to see if this property has a name that would
conflict with a given name.
|
findAnnotation
findAliases, findFormatOverrides, findPropertyFormat, findPropertyInclusion, getMetadata, isRequired, isVirtual
public static final java.lang.Object MARKER_FOR_EMPTY
public BeanPropertyWriter(BeanPropertyDefinition propDef, AnnotatedMember member, Annotations contextAnnotations, JavaType declaredType, JsonSerializer<?> ser, TypeSerializer typeSer, JavaType serType, boolean suppressNulls, java.lang.Object suppressableValue, java.lang.Class<?>[] includeInViews)
@Deprecated public BeanPropertyWriter(BeanPropertyDefinition propDef, AnnotatedMember member, Annotations contextAnnotations, JavaType declaredType, JsonSerializer<?> ser, TypeSerializer typeSer, JavaType serType, boolean suppressNulls, java.lang.Object suppressableValue)
public BeanPropertyWriter rename(NameTransformer transformer)
public void assignTypeSerializer(TypeSerializer typeSer)
public void assignSerializer(JsonSerializer<java.lang.Object> ser)
public void assignNullSerializer(JsonSerializer<java.lang.Object> nullSer)
public BeanPropertyWriter unwrappingWriter(NameTransformer unwrapper)
public void setNonTrivialBaseType(JavaType t)
public void fixAccess(SerializationConfig config)
public java.lang.String getName()
BeanProperty
getName
in interface BeanProperty
getName
in interface Named
getName
in class PropertyWriter
public PropertyName getFullName()
BeanProperty
getFullName
in interface BeanProperty
getFullName
in class PropertyWriter
public JavaType getType()
BeanProperty
getType
in interface BeanProperty
public PropertyName getWrapperName()
BeanProperty
getWrapperName
in interface BeanProperty
public <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> acls)
PropertyWriter
getAnnotation
in interface BeanProperty
getAnnotation
in class PropertyWriter
public <A extends java.lang.annotation.Annotation> A getContextAnnotation(java.lang.Class<A> acls)
PropertyWriter
getContextAnnotation
in interface BeanProperty
getContextAnnotation
in class PropertyWriter
public AnnotatedMember getMember()
BeanProperty
getMember
in interface BeanProperty
public java.lang.Object getInternalSetting(java.lang.Object key)
public java.lang.Object setInternalSetting(java.lang.Object key, java.lang.Object value)
public java.lang.Object removeInternalSetting(java.lang.Object key)
public SerializableString getSerializedName()
public boolean hasSerializer()
public boolean hasNullSerializer()
public TypeSerializer getTypeSerializer()
public boolean isUnwrapping()
Default implementation simply returns false.
public boolean willSuppressNulls()
public boolean wouldConflictWithName(PropertyName name)
public JsonSerializer<java.lang.Object> getSerializer()
public JavaType getSerializationType()
@Deprecated public java.lang.Class<?> getRawSerializationType()
@Deprecated public java.lang.Class<?> getPropertyType()
getType()
instead.@Deprecated public java.lang.reflect.Type getGenericPropertyType()
getType()
instead.public java.lang.Class<?>[] getViews()
public void serializeAsField(java.lang.Object bean, JsonGenerator gen, SerializerProvider prov) throws java.lang.Exception
serializeAsField
in class PropertyWriter
java.lang.Exception
public void serializeAsOmittedField(java.lang.Object bean, JsonGenerator gen, SerializerProvider prov) throws java.lang.Exception
serializeAsOmittedField
in class PropertyWriter
java.lang.Exception
public void serializeAsElement(java.lang.Object bean, JsonGenerator gen, SerializerProvider prov) throws java.lang.Exception
serializeAsField(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)
that is used when a POJO is
serialized as JSON Array; the difference is that no field names are
written.serializeAsElement
in class PropertyWriter
java.lang.Exception
public void serializeAsPlaceholder(java.lang.Object bean, JsonGenerator gen, SerializerProvider prov) throws java.lang.Exception
serializeAsPlaceholder
in class PropertyWriter
java.lang.Exception
public void depositSchemaProperty(JsonObjectFormatVisitor v, SerializerProvider provider) throws JsonMappingException
PropertyWriter
depositSchemaProperty
in interface BeanProperty
depositSchemaProperty
in class PropertyWriter
v
- Visitor to used as the callback handlerJsonMappingException
@Deprecated public void depositSchemaProperty(ObjectNode propertiesNode, SerializerProvider provider) throws JsonMappingException
BeanPropertyWriter
in the
given ObjectNode
. Otherwise, add the default schema
JsonNode
in place of the writer's outputdepositSchemaProperty
in class PropertyWriter
propertiesNode
- Node which the given property would exist withinprovider
- Provider that can be used for accessing dynamic aspects of
serialization processingJsonMappingException
public final java.lang.Object get(java.lang.Object bean) throws java.lang.Exception
Note: method is final as it should not need to be overridden -- rather,
calling method(s) (serializeAsField(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)
) should be overridden to
change the behavior
java.lang.Exception
public java.lang.String toString()
toString
in class java.lang.Object
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"