public class BeanPropertyWriter extends PropertyWriter implements BeanProperty
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.Std| Modifier and Type | Field and Description | 
|---|---|
| protected Method | _accessorMethodAccessor method used to get property value, for
 method-accessible properties. | 
| protected JavaType | _cfgSerializationTypeType to use for locating serializer; normally same as return
 type of the accessor method, but may be overridden by annotations. | 
| protected Annotations | _contextAnnotationsAnnotations from context (most often, class that declares property,
 or in case of sub-class serializer, from that sub-class) | 
| protected JavaType | _declaredTypeType property is declared to have, either in class definition 
 or associated annotations. | 
| protected PropertySerializerMap | _dynamicSerializersIn case serializer is not known statically (i.e. | 
| protected Field | _fieldField that contains the property value for field-accessible
 properties. | 
| protected com.fasterxml.jackson.annotation.JsonFormat.Value | _formatLazily accessed value for per-property format override definition. | 
| protected Class<?>[] | _includeInViewsAlternate set of property writers used when view-based filtering
 is available for the Bean. | 
| protected HashMap<Object,Object> | _internalSettings | 
| protected AnnotatedMember | _memberMember (field, method) that represents property and allows access
 to associated annotations. | 
| protected PropertyMetadata | _metadataAdditional information about property | 
| protected com.fasterxml.jackson.core.io.SerializedString | _nameLogical name of the property; will be used as the field name
 under which value for the property is written. | 
| protected JavaType | _nonTrivialBaseTypeBase type of the property, if the declared type is "non-trivial";
 meaning it is either a structured type (collection, map, array),
 or parameterized. | 
| protected JsonSerializer<Object> | _nullSerializerSerializer used for writing out null values, if any: if null,
 null values are to be suppressed. | 
| protected JsonSerializer<Object> | _serializerSerializer to use for writing out the value: null if it can not
 be known statically; non-null if it can. | 
| protected Object | _suppressableValueValue that is considered default value of the property; used for
 default-value-suppression if enabled. | 
| protected boolean | _suppressNullsWhether null values are to be suppressed (nothing written out if
 value is null) or not. | 
| protected TypeSerializer | _typeSerializerIf property being serialized needs type information to be
 included this is the type serializer to use. | 
| protected PropertyName | _wrapperNameWrapper name to use for this element, if any | 
| static Object | MARKER_FOR_EMPTYMarker object used to indicate "do not serialize if empty" | 
| protected static com.fasterxml.jackson.annotation.JsonFormat.Value | NO_FORMATMarker we use to indicate case where we have done format lookup,
 but found nothing; marker used to avoid having to repeat such lookups. | 
| Modifier | Constructor and Description | 
|---|---|
| protected  | BeanPropertyWriter()Constructor that may be of use to virtual properties, when there is need for
 the zero-arg ("default") constructor, and actual initialization is done
 after constructor call. | 
|   | BeanPropertyWriter(BeanPropertyDefinition propDef,
                  AnnotatedMember member,
                  Annotations contextAnnotations,
                  JavaType declaredType,
                  JsonSerializer<?> ser,
                  TypeSerializer typeSer,
                  JavaType serType,
                  boolean suppressNulls,
                  Object suppressableValue) | 
| protected  | BeanPropertyWriter(BeanPropertyWriter base)"Copy constructor" to be used by filtering sub-classes | 
| protected  | BeanPropertyWriter(BeanPropertyWriter base,
                  PropertyName name) | 
| protected  | BeanPropertyWriter(BeanPropertyWriter base,
                  com.fasterxml.jackson.core.io.SerializedString name) | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | _depositSchemaProperty(ObjectNode propertiesNode,
                      JsonNode schemaNode) | 
| protected JsonSerializer<Object> | _findAndAddDynamic(PropertySerializerMap map,
                  Class<?> type,
                  SerializerProvider provider) | 
| protected boolean | _handleSelfReference(Object bean,
                    com.fasterxml.jackson.core.JsonGenerator gen,
                    SerializerProvider prov,
                    JsonSerializer<?> ser)Method called to handle a direct self-reference through this property. | 
| protected BeanPropertyWriter | _new(PropertyName newName)Overridable factory method used by sub-classes | 
| void | assignNullSerializer(JsonSerializer<Object> nullSer)Method called to assign null value serializer for property | 
| void | assignSerializer(JsonSerializer<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)Traversal method used for things like JSON Schema generation, or
 POJO introspection. | 
| void | depositSchemaProperty(ObjectNode propertiesNode,
                     SerializerProvider provider)Deprecated.  | 
| com.fasterxml.jackson.annotation.JsonFormat.Value | findFormatOverrides(AnnotationIntrospector intr)Convenience method that is roughly equivalent to | 
| Object | get(Object bean)Method that can be used to access value of the property this
 Object describes, from given bean instance. | 
| <A extends Annotation> | getAnnotation(Class<A> acls)Method for accessing annotations directly declared for property that this
 writer is associated with. | 
| <A extends Annotation> | getContextAnnotation(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). | 
| Type | getGenericPropertyType()Get the generic property type of this property writer. | 
| Object | getInternalSetting(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. | 
| PropertyMetadata | getMetadata()Accessor for additional optional information about property. | 
| String | getName()Method to get logical name of the property | 
| Class<?> | getPropertyType() | 
| Class<?> | getRawSerializationType() | 
| JavaType | getSerializationType() | 
| com.fasterxml.jackson.core.SerializableString | getSerializedName() | 
| JsonSerializer<Object> | getSerializer() | 
| JavaType | getType()Method to get declared type of the property. | 
| TypeSerializer | getTypeSerializer() | 
| Class<?>[] | getViews() | 
| PropertyName | getWrapperName()If property is indicated to be wrapped, name of
 wrapper element to use. | 
| boolean | hasNullSerializer() | 
| boolean | hasSerializer() | 
| boolean | isRequired()Whether value for property is marked as required using
 annotations or associated schema. | 
| 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). | 
| boolean | isVirtual()Note: will be defined in  BeanProperty; as of now is not yet. | 
| Object | removeInternalSetting(Object key)Method for removing entry for specified internal setting. | 
| BeanPropertyWriter | rename(NameTransformer transformer) | 
| void | serializeAsElement(Object bean,
                  com.fasterxml.jackson.core.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(Object bean,
                com.fasterxml.jackson.core.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(Object bean,
                       com.fasterxml.jackson.core.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(Object bean,
                      com.fasterxml.jackson.core.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. | 
| Object | setInternalSetting(Object key,
                  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 | 
| 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. | 
findAnnotationpublic static final Object MARKER_FOR_EMPTY
protected static final com.fasterxml.jackson.annotation.JsonFormat.Value NO_FORMAT
protected final AnnotatedMember _member
protected final Annotations _contextAnnotations
protected final JavaType _declaredType
protected final Method _accessorMethod
_field is null.protected final Field _field
_accessorMethod is null.protected final com.fasterxml.jackson.core.io.SerializedString _name
NOTE: do NOT change name of this field; it is accessed by Afterburner module (until 2.4; not directly from 2.5) ALSO NOTE: ... and while it really ought to be `SerializableString`, changing that is also binary-incompatible change. So nope.
protected final PropertyName _wrapperName
protected final JavaType _cfgSerializationType
protected JavaType _nonTrivialBaseType
protected final PropertyMetadata _metadata
protected transient com.fasterxml.jackson.annotation.JsonFormat.Value _format
protected JsonSerializer<Object> _serializer
protected JsonSerializer<Object> _nullSerializer
protected TypeSerializer _typeSerializer
protected transient PropertySerializerMap _dynamicSerializers
_serializer
 is null), we will use a lookup structure for storing dynamically
 resolved mapping from type(s) to serializer(s).protected final boolean _suppressNulls
_nullSerializer.protected final Object _suppressableValue
protected final Class<?>[] _includeInViews
public BeanPropertyWriter(BeanPropertyDefinition propDef, AnnotatedMember member, Annotations contextAnnotations, JavaType declaredType, JsonSerializer<?> ser, TypeSerializer typeSer, JavaType serType, boolean suppressNulls, Object suppressableValue)
protected BeanPropertyWriter()
protected BeanPropertyWriter(BeanPropertyWriter base)
protected BeanPropertyWriter(BeanPropertyWriter base, PropertyName name)
protected BeanPropertyWriter(BeanPropertyWriter base, com.fasterxml.jackson.core.io.SerializedString name)
public BeanPropertyWriter rename(NameTransformer transformer)
protected BeanPropertyWriter _new(PropertyName newName)
public void assignTypeSerializer(TypeSerializer typeSer)
public void assignSerializer(JsonSerializer<Object> ser)
public void assignNullSerializer(JsonSerializer<Object> nullSer)
public BeanPropertyWriter unwrappingWriter(NameTransformer unwrapper)
public void setNonTrivialBaseType(JavaType t)
public String getName()
BeanPropertygetName in interface BeanPropertygetName in interface NamedgetName in class PropertyWriterpublic PropertyName getFullName()
BeanPropertygetFullName in interface BeanPropertygetFullName in class PropertyWriterpublic JavaType getType()
BeanPropertygetType in interface BeanPropertypublic PropertyName getWrapperName()
BeanPropertygetWrapperName in interface BeanPropertypublic boolean isRequired()
BeanProperty
  getMetadata().isRequired()
isRequired in interface BeanPropertypublic PropertyMetadata getMetadata()
BeanPropertygetMetadata in interface BeanPropertypublic <A extends Annotation> A getAnnotation(Class<A> acls)
PropertyWritergetAnnotation in interface BeanPropertygetAnnotation in class PropertyWriterpublic <A extends Annotation> A getContextAnnotation(Class<A> acls)
PropertyWritergetContextAnnotation in interface BeanPropertygetContextAnnotation in class PropertyWriterpublic com.fasterxml.jackson.annotation.JsonFormat.Value findFormatOverrides(AnnotationIntrospector intr)
BeanPropertyreturn intr.findFormat(getMember());
findFormatOverrides in interface BeanPropertypublic AnnotatedMember getMember()
BeanPropertygetMember in interface BeanPropertyprotected void _depositSchemaProperty(ObjectNode propertiesNode, JsonNode schemaNode)
public boolean isVirtual()
BeanProperty; as of now is not yet.
 TODO: move to BeanProperty in near future, once all standard
 implementations define it.
public Object getInternalSetting(Object key)
public Object setInternalSetting(Object key, Object value)
public Object removeInternalSetting(Object key)
public com.fasterxml.jackson.core.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<Object> getSerializer()
public JavaType getSerializationType()
public Class<?> getRawSerializationType()
public Class<?> getPropertyType()
public Type getGenericPropertyType()
public Class<?>[] getViews()
public void serializeAsField(Object bean, com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider prov) throws Exception
serializeAsField in class PropertyWriterExceptionpublic void serializeAsOmittedField(Object bean, com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider prov) throws Exception
serializeAsOmittedField in class PropertyWriterExceptionpublic void serializeAsElement(Object bean, com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider prov) throws 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 PropertyWriterExceptionpublic void serializeAsPlaceholder(Object bean, com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider prov) throws Exception
serializeAsPlaceholder in class PropertyWriterExceptionpublic void depositSchemaProperty(JsonObjectFormatVisitor v) throws JsonMappingException
PropertyWriterdepositSchemaProperty in interface BeanPropertydepositSchemaProperty in class PropertyWriterv - 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 PropertyWriterpropertiesNode - Node which the given property would exist withinprovider - Provider that can be used for accessing dynamic aspects of serialization
  processingJsonMappingExceptionprotected JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map, Class<?> type, SerializerProvider provider) throws JsonMappingException
JsonMappingExceptionpublic final Object get(Object bean) throws 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
Exceptionprotected boolean _handleSelfReference(Object bean, com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider prov, JsonSerializer<?> ser) throws JsonMappingException
JsonMappingException;
 fully handle serialization (and return true); or indicate that it should be
 serialized normally (return false).
 Default implementation will throw JsonMappingException if
 SerializationFeature.FAIL_ON_SELF_REFERENCES is enabled;
 or return false if it is disabled.
JsonMappingException if there is no way handle itJsonMappingExceptionCopyright © 2014–2015 FasterXML. All rights reserved.