Class VirtualBeanPropertyWriter
java.lang.Object
com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase
com.fasterxml.jackson.databind.ser.PropertyWriter
com.fasterxml.jackson.databind.ser.BeanPropertyWriter
com.fasterxml.jackson.databind.ser.VirtualBeanPropertyWriter
- All Implemented Interfaces:
BeanProperty,Named,Serializable
- Direct Known Subclasses:
AttributePropertyWriter
BeanPropertyWriter implementation used with
JsonAppend
to add "virtual" properties in addition to regular ones.- Since:
- 2.5
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.fasterxml.jackson.databind.BeanProperty
BeanProperty.Bogus, BeanProperty.Std -
Field Summary
Fields inherited from class com.fasterxml.jackson.databind.ser.BeanPropertyWriter
MARKER_FOR_EMPTYFields inherited from interface com.fasterxml.jackson.databind.BeanProperty
EMPTY_FORMAT, EMPTY_INCLUDE -
Method Summary
Modifier and TypeMethodDescriptionbooleanAccessor for checking whether there is an actual physical property behind this property abstraction or not.voidserializeAsElement(Object bean, JsonGenerator gen, SerializerProvider prov) Alternative toBeanPropertyWriter.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.voidserializeAsField(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.abstract VirtualBeanPropertyWriterwithConfig(MapperConfig<?> config, AnnotatedClass declaringClass, BeanPropertyDefinition propDef, JavaType type) Contextualization method called on a newly constructed virtual bean property.Methods inherited from class com.fasterxml.jackson.databind.ser.BeanPropertyWriter
assignNullSerializer, assignSerializer, assignTypeSerializer, depositSchemaProperty, depositSchemaProperty, fixAccess, get, getAnnotation, getContextAnnotation, getFullName, getGenericPropertyType, getInternalSetting, getMember, getName, getPropertyType, getRawSerializationType, getSerializationType, getSerializedName, getSerializer, getType, getTypeSerializer, getViews, getWrapperName, hasNullSerializer, hasSerializer, isUnwrapping, removeInternalSetting, rename, serializeAsOmittedField, serializeAsPlaceholder, setInternalSetting, setNonTrivialBaseType, toString, unwrappingWriter, willSuppressNulls, wouldConflictWithNameMethods inherited from class com.fasterxml.jackson.databind.ser.PropertyWriter
findAnnotationMethods inherited from class com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase
findAliases, findFormatOverrides, findPropertyFormat, findPropertyInclusion, getMetadata, isRequired
-
Method Details
-
isVirtual
public boolean isVirtual()Description copied from interface:BeanPropertyAccessor for checking whether there is an actual physical property behind this property abstraction or not.- Specified by:
isVirtualin interfaceBeanProperty- Overrides:
isVirtualin classConcreteBeanPropertyBase
-
withConfig
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- Currenct configuration; guaranteed to beSerializationConfig(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 property
-
serializeAsField
public void serializeAsField(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception Description copied from class:BeanPropertyWriterMethod 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.- Overrides:
serializeAsFieldin classBeanPropertyWriter- Throws:
Exception
-
serializeAsElement
public void serializeAsElement(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception Description copied from class:BeanPropertyWriterAlternative toBeanPropertyWriter.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.- Overrides:
serializeAsElementin classBeanPropertyWriter- Throws:
Exception
-