Top Description Fields Constructors Methods
com.fasterxml.jackson.databind.ser

public abstract Class VirtualBeanPropertyWriter

extends BeanPropertyWriter
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
com.fasterxml.jackson.databind.ser.impl.AttributePropertyWriter
Imports
com.fasterxml.jackson.annotation.JsonInclude, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.cfg.MapperConfig, com.fasterxml.jackson.databind.introspect.*, com.fasterxml.jackson.databind.jsontype.TypeSerializer, com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap, com.fasterxml.jackson.databind.util.Annotations

BeanPropertyWriter implementation used with com.fasterxml.jackson.databind.annotation.JsonAppend to add "virtual" properties in addition to regular ones.
Since
2.5
See Also
com.fasterxml.jackson.databind.ser.impl.AttributePropertyWriter

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from com.fasterxml.jackson.databind.ser.BeanPropertyWriter:
_accessorMethod_cfgSerializationType_contextAnnotations_declaredType_dynamicSerializers_field_includeInViews_internalSettings_member_name_nonTrivialBaseType_nullSerializer_serializer_suppressableValue_suppressNulls_typeSerializer_wrapperNameMARKER_FOR_EMPTY

Constructor Summary

AccessConstructor and Description
protected
VirtualBeanPropertyWriter(BeanPropertyDefinition propDef, Annotations contextAnnotations, JavaType declaredType)

Constructor used by most sub-types.

protected
VirtualBeanPropertyWriter()

Constructor that may be used by sub-classes for constructing a "blue-print" instance; one that will only become (or create) actual usable instance when its withConfig method is called.

protected
VirtualBeanPropertyWriter(BeanPropertyDefinition propDef, Annotations contextAnnotations, JavaType declaredType, JsonSerializer<?> ser, TypeSerializer typeSer, JavaType serType, JsonInclude.Value inclusion, Class<?>[] includeInViews)

Pass-through constructor that may be used by sub-classes that want full control over implementation.

protected
VirtualBeanPropertyWriter(BeanPropertyDefinition propDef, Annotations contextAnnotations, JavaType declaredType, JsonSerializer<?> ser, TypeSerializer typeSer, JavaType serType, JsonInclude.Value inclusion)
Deprecated

protected
protected

Method Summary

Modifier and TypeMethod and Description
protected static Object
protected static boolean
public boolean
isVirtual()

Overrides com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase.isVirtual.

Implements com.fasterxml.jackson.databind.BeanProperty.isVirtual.

Accessor for checking whether there is an actual physical property behind this property abstraction or not.

public void
serializeAsElement(Object bean, JsonGenerator gen, SerializerProvider prov)

Overrides com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsElement.

Alternative to serializeAsField that is used when a POJO is serialized as JSON Array; the difference is that no field names are written.

public void
serializeAsField(Object bean, JsonGenerator gen, SerializerProvider prov)

Overrides com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField.

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.

protected abstract Object
value(Object bean, JsonGenerator gen, SerializerProvider prov)

Method called to figure out the value to serialize.

public abstract VirtualBeanPropertyWriter
withConfig(MapperConfig<?>
Currenct configuration; guaranteed to be SerializationConfig (just not typed since caller does not have dependency to serialization-specific types)
config
,
AnnotatedClass
Class that contains this property writer
declaringClass
,
BeanPropertyDefinition
Nominal property definition to use
propDef
,
JavaType
Declared type for the property
type
)

Contextualization method called on a newly constructed virtual bean property.

Inherited from com.fasterxml.jackson.databind.ser.BeanPropertyWriter:
_depositSchemaProperty_findAndAddDynamic_handleSelfReference_newassignNullSerializerassignSerializerassignTypeSerializerdepositSchemaPropertydepositSchemaPropertyfixAccessgetgetAnnotationgetContextAnnotationgetFullNamegetGenericPropertyTypegetInternalSettinggetMembergetNamegetPropertyTypegetRawSerializationTypegetSerializationTypegetSerializedNamegetSerializergetTypegetTypeSerializergetViewsgetWrapperNamehasNullSerializerhasSerializerisUnwrappingremoveInternalSettingrenameserializeAsOmittedFieldserializeAsPlaceholdersetInternalSettingsetNonTrivialBaseTypetoStringunwrappingWriterwillSuppressNullswouldConflictWithName

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serialVersionUID.

Constructor Detail

VirtualBeanPropertyWriterback to summary
protected VirtualBeanPropertyWriter(BeanPropertyDefinition propDef, Annotations contextAnnotations, JavaType declaredType)

Constructor used by most sub-types.

VirtualBeanPropertyWriterback to summary
protected VirtualBeanPropertyWriter()

Constructor that may be used by sub-classes for constructing a "blue-print" instance; one that will only become (or create) actual usable instance when its withConfig method is called.

VirtualBeanPropertyWriterback to summary
protected VirtualBeanPropertyWriter(BeanPropertyDefinition propDef, Annotations contextAnnotations, JavaType declaredType, JsonSerializer<?> ser, TypeSerializer typeSer, JavaType serType, JsonInclude.Value inclusion, Class<?>[] includeInViews)

Pass-through constructor that may be used by sub-classes that want full control over implementation.

VirtualBeanPropertyWriterback to summary
protected VirtualBeanPropertyWriter(BeanPropertyDefinition propDef, Annotations contextAnnotations, JavaType declaredType, JsonSerializer<?> ser, TypeSerializer typeSer, JavaType serType, JsonInclude.Value inclusion)

Deprecated

Annotations
@Deprecated
VirtualBeanPropertyWriterback to summary
protected VirtualBeanPropertyWriter(VirtualBeanPropertyWriter base)
VirtualBeanPropertyWriterback to summary
protected VirtualBeanPropertyWriter(VirtualBeanPropertyWriter base, PropertyName name)

Method Detail

_suppressableValueback to summary
protected static Object _suppressableValue(JsonInclude.Value inclusion)
_suppressNullsback to summary
protected static boolean _suppressNulls(JsonInclude.Value inclusion)
isVirtualback to summary
public boolean isVirtual()

Overrides com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase.isVirtual.

Implements com.fasterxml.jackson.databind.BeanProperty.isVirtual.

Doc from com.fasterxml.jackson.databind.BeanProperty.isVirtual.

Accessor for checking whether there is an actual physical property behind this property abstraction or not.

Annotations
@Override
serializeAsElementback to summary
public void serializeAsElement(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception

Overrides com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsElement.

Doc from com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsElement.

Alternative to serializeAsField that is used when a POJO is serialized as JSON Array; the difference is that no field names are written.

Annotations
@Override
serializeAsFieldback to summary
public void serializeAsField(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception

Overrides com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField.

Doc from com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField.

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.

Annotations
@Override
valueback to summary
protected abstract Object value(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception

Method called to figure out the value to serialize. For simple sub-types (such as com.fasterxml.jackson.databind.ser.impl.AttributePropertyWriter) this may be one of few methods to define, although more advanced implementations may choose to not even use this method (by overriding serializeAsField) and define a bogus implementation.

withConfigback to summary
public abstract VirtualBeanPropertyWriter withConfig(MapperConfig<?> config, AnnotatedClass declaringClass, BeanPropertyDefinition propDef, JavaType type)

Contextualization method called on a newly constructed virtual bean property. Usually a new intance needs to be created due to finality of some of configuration members; otherwise while recommended, creating a new instance is not strictly-speaking mandatory because calls are made in thread-safe manner, as part of initialization before use.

Parameters
config:MapperConfig<?>

Currenct configuration; guaranteed to be SerializationConfig (just not typed since caller does not have dependency to serialization-specific types)

declaringClass:AnnotatedClass

Class that contains this property writer

propDef:BeanPropertyDefinition

Nominal property definition to use

type:JavaType

Declared type for the property