public abstract class VirtualBeanPropertyWriter extends BeanPropertyWriter implements Serializable
BeanPropertyWriter
implementation used with
JsonAppend
to add "virtual" properties in addition to regular ones.AttributePropertyWriter
,
Serialized FormBeanProperty.Std
_accessorMethod, _cfgSerializationType, _contextAnnotations, _declaredType, _dynamicSerializers, _field, _format, _includeInViews, _internalSettings, _member, _metadata, _name, _nonTrivialBaseType, _nullSerializer, _serializer, _suppressableValue, _suppressNulls, _typeSerializer, _wrapperName, MARKER_FOR_EMPTY, NO_FORMAT
Modifier | Constructor and Description |
---|---|
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(com.fasterxml.jackson.databind.cfg.MapperConfig<?>, com.fasterxml.jackson.databind.introspect.AnnotatedClass, com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition, com.fasterxml.jackson.databind.JavaType) method is called. |
protected |
VirtualBeanPropertyWriter(BeanPropertyDefinition propDef,
Annotations contextAnnotations,
JavaType declaredType)
Constructor used by most sub-types.
|
protected |
VirtualBeanPropertyWriter(BeanPropertyDefinition propDef,
Annotations contextAnnotations,
JavaType declaredType,
JsonSerializer<?> ser,
TypeSerializer typeSer,
JavaType serType,
JsonInclude.Include inclusion)
Pass-through constructor that may be used by sub-classes that
want full control over implementation.
|
protected |
VirtualBeanPropertyWriter(VirtualBeanPropertyWriter base) |
protected |
VirtualBeanPropertyWriter(VirtualBeanPropertyWriter base,
PropertyName name) |
Modifier and Type | Method and Description |
---|---|
protected static Object |
_suppressableValue(JsonInclude.Include inclusion) |
protected static boolean |
_suppressNulls(JsonInclude.Include inclusion) |
Type |
getGenericPropertyType()
Get the generic property type of this property writer.
|
Class<?> |
getPropertyType() |
boolean |
isVirtual()
Note: will be defined in
BeanProperty ; as of now is not yet. |
void |
serializeAsElement(Object bean,
JsonGenerator gen,
SerializerProvider prov)
Alternative to
BeanPropertyWriter.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,
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.
|
protected abstract Object |
value(Object bean,
JsonGenerator jgen,
SerializerProvider prov)
Method called to figure out the value to serialize.
|
abstract VirtualBeanPropertyWriter |
withConfig(MapperConfig<?> config,
AnnotatedClass declaringClass,
BeanPropertyDefinition propDef,
JavaType type)
Contextualization method called on a newly constructed virtual bean property.
|
_depositSchemaProperty, _findAndAddDynamic, _handleSelfReference, _new, assignNullSerializer, assignSerializer, assignTypeSerializer, depositSchemaProperty, depositSchemaProperty, findFormatOverrides, get, getAnnotation, getContextAnnotation, getFullName, getInternalSetting, getMember, getMetadata, getName, getRawSerializationType, getSerializationType, getSerializedName, getSerializer, getType, getTypeSerializer, getViews, getWrapperName, hasNullSerializer, hasSerializer, isRequired, isUnwrapping, removeInternalSetting, rename, serializeAsOmittedField, serializeAsPlaceholder, setInternalSetting, setNonTrivialBaseType, toString, unwrappingWriter, willSuppressNulls, wouldConflictWithName
findAnnotation
protected VirtualBeanPropertyWriter(BeanPropertyDefinition propDef, Annotations contextAnnotations, JavaType declaredType)
protected VirtualBeanPropertyWriter()
withConfig(com.fasterxml.jackson.databind.cfg.MapperConfig<?>, com.fasterxml.jackson.databind.introspect.AnnotatedClass, com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition, com.fasterxml.jackson.databind.JavaType)
method is called.protected VirtualBeanPropertyWriter(BeanPropertyDefinition propDef, Annotations contextAnnotations, JavaType declaredType, JsonSerializer<?> ser, TypeSerializer typeSer, JavaType serType, JsonInclude.Include inclusion)
protected VirtualBeanPropertyWriter(VirtualBeanPropertyWriter base)
protected VirtualBeanPropertyWriter(VirtualBeanPropertyWriter base, PropertyName name)
protected static boolean _suppressNulls(JsonInclude.Include inclusion)
protected static Object _suppressableValue(JsonInclude.Include inclusion)
public boolean isVirtual()
BeanPropertyWriter
BeanProperty
; as of now is not yet.
TODO: move to BeanProperty
in near future, once all standard
implementations define it.
isVirtual
in class BeanPropertyWriter
public Class<?> getPropertyType()
getPropertyType
in class BeanPropertyWriter
public Type getGenericPropertyType()
BeanPropertyWriter
getGenericPropertyType
in class BeanPropertyWriter
protected abstract Object value(Object bean, JsonGenerator jgen, SerializerProvider prov) throws Exception
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(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)
)
and define a bogus implementation.Exception
public abstract VirtualBeanPropertyWriter withConfig(MapperConfig<?> config, AnnotatedClass declaringClass, BeanPropertyDefinition propDef, JavaType type)
config
- Currenct configuration; guaranteed to be SerializationConfig
(just not typed since caller does not have dependency to serialization-specific types)declaringClass
- Class that contains this property writerpropDef
- Nominal property definition to usetype
- Declared type for the propertypublic void serializeAsField(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception
BeanPropertyWriter
serializeAsField
in class BeanPropertyWriter
Exception
public void serializeAsElement(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception
BeanPropertyWriter
BeanPropertyWriter.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 BeanPropertyWriter
Exception
Copyright © 2008–2018 FasterXML. All rights reserved.