Top Description Fields Constructors Methods
tools.jackson.databind.ser

public abstract Class VirtualBeanPropertyWriter

extends BeanPropertyWriter
Class Inheritance
Known Direct Subclasses
tools.jackson.databind.ser.impl.AttributePropertyWriter
Imports
com.fasterxml.jackson.annotation.JsonInclude, tools.jackson.core.JsonGenerator, tools.jackson.databind.*, tools.jackson.databind.cfg.MapperConfig, tools.jackson.databind.introspect.*, tools.jackson.databind.jsontype.TypeSerializer, tools.jackson.databind.ser.impl.PropertySerializerMap, tools.jackson.databind.util.Annotations

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

Field Summary

Inherited from tools.jackson.databind.ser.BeanPropertyWriter:
_accessor_cfgSerializationType_contextAnnotations_declaredType_dynamicSerializers_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, ValueSerializer<?> 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
protected

Method Summary

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

Overrides tools.jackson.databind.introspect.ConcreteBeanPropertyBase.isVirtual.

Implements tools.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 g, SerializationContext prov)

Overrides tools.jackson.databind.ser.BeanPropertyWriter.serializeAsElement.

Alternative to serializeAsProperty that is used when a POJO is serialized as JSON Array (usually when "Shape" is forced as 'Array'): the difference is that no property names are written.

public void
serializeAsProperty(Object bean, JsonGenerator g, SerializationContext prov)

Overrides tools.jackson.databind.ser.BeanPropertyWriter.serializeAsProperty.

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 g, SerializationContext 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 tools.jackson.databind.ser.BeanPropertyWriter:
_depositSchemaProperty_findAndAddDynamic_handleSelfReference_newassignNullSerializerassignSerializerassignTypeSerializerdepositSchemaPropertyfixAccessgetgetAnnotationgetContextAnnotationgetFullNamegetInternalSettinggetMembergetNamegetSerializationTypegetSerializedNamegetSerializergetTypegetTypeSerializergetViewsgetWrapperNamehasNullSerializerhasSerializerisUnwrappingremoveInternalSettingrenameserializeAsOmittedElementserializeAsOmittedPropertysetInternalSettingsetNonTrivialBaseTypetoStringunwrappingWriterwillSuppressNullswouldConflictWithName

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, ValueSerializer<?> 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(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 tools.jackson.databind.introspect.ConcreteBeanPropertyBase.isVirtual.

Implements tools.jackson.databind.BeanProperty.isVirtual.

Doc from tools.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 g, SerializationContext prov) throws Exception

Overrides tools.jackson.databind.ser.BeanPropertyWriter.serializeAsElement.

Doc from tools.jackson.databind.ser.BeanPropertyWriter.serializeAsElement.

Alternative to serializeAsProperty that is used when a POJO is serialized as JSON Array (usually when "Shape" is forced as 'Array'): the difference is that no property names are written.

Annotations
@Override
serializeAsPropertyback to summary
public void serializeAsProperty(Object bean, JsonGenerator g, SerializationContext prov) throws Exception

Overrides tools.jackson.databind.ser.BeanPropertyWriter.serializeAsProperty.

Doc from tools.jackson.databind.ser.BeanPropertyWriter.serializeAsProperty.

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 g, SerializationContext prov) throws Exception

Method called to figure out the value to serialize. For simple sub-types (such as tools.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 serializeAsProperty) 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