public class MapProperty extends PropertyWriter
Map
s
are not handled as a collection of properties by Jackson (unlike POJOs),
bit more wrapping is required.BeanProperty.Bogus, BeanProperty.Std
Modifier and Type | Field and Description |
---|---|
protected Object |
_key |
protected JsonSerializer<Object> |
_keySerializer |
protected BeanProperty |
_property |
protected TypeSerializer |
_typeSerializer |
protected Object |
_value |
protected JsonSerializer<Object> |
_valueSerializer |
_aliases, _metadata, _propertyFormat
EMPTY_FORMAT, EMPTY_INCLUDE
Constructor and Description |
---|
MapProperty(TypeSerializer typeSer,
BeanProperty prop) |
Modifier and Type | Method and Description |
---|---|
void |
depositSchemaProperty(JsonObjectFormatVisitor objectVisitor,
SerializerProvider provider)
Traversal method used for things like JSON Schema generation, or
POJO introspection.
|
void |
depositSchemaProperty(ObjectNode propertiesNode,
SerializerProvider provider)
Deprecated.
|
<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).
|
AnnotatedMember |
getMember()
Method for accessing primary physical entity that represents the property;
annotated field, method or constructor property.
|
String |
getName()
Method to get logical name of the property
|
JavaType |
getType()
Method to get declared type of the property.
|
Object |
getValue() |
PropertyName |
getWrapperName()
If property is indicated to be wrapped, name of
wrapper element to use.
|
void |
reset(Object key,
JsonSerializer<Object> keySer,
JsonSerializer<Object> valueSer)
Deprecated.
|
void |
reset(Object key,
Object value,
JsonSerializer<Object> keySer,
JsonSerializer<Object> valueSer)
Initialization method that needs to be called before passing
property to filter.
|
void |
serializeAsElement(Object map,
JsonGenerator gen,
SerializerProvider provider)
Serialization method called when output is to be done as an array,
that is, not using property names.
|
void |
serializeAsField(Object map,
JsonGenerator gen,
SerializerProvider provider)
The main serialization method called by filter when property is to be written normally.
|
void |
serializeAsOmittedField(Object map,
JsonGenerator gen,
SerializerProvider provider)
Serialization method that filter needs to call in cases where property is to be
filtered, but the underlying data format requires a placeholder of some kind.
|
void |
serializeAsPlaceholder(Object value,
JsonGenerator gen,
SerializerProvider provider)
Serialization method called when doing tabular (positional) output from databind,
but then value is to be omitted.
|
void |
setValue(Object v) |
findAnnotation
findAliases, findFormatOverrides, findPropertyFormat, findPropertyInclusion, getMetadata, isRequired, isVirtual
protected final TypeSerializer _typeSerializer
protected final BeanProperty _property
protected Object _key
protected Object _value
protected JsonSerializer<Object> _keySerializer
protected JsonSerializer<Object> _valueSerializer
public MapProperty(TypeSerializer typeSer, BeanProperty prop)
public void reset(Object key, Object value, JsonSerializer<Object> keySer, JsonSerializer<Object> valueSer)
@Deprecated public void reset(Object key, JsonSerializer<Object> keySer, JsonSerializer<Object> valueSer)
public String getName()
BeanProperty
getName
in interface BeanProperty
getName
in interface Named
getName
in class PropertyWriter
public Object getValue()
public void setValue(Object v)
public PropertyName getFullName()
BeanProperty
getFullName
in interface BeanProperty
getFullName
in class PropertyWriter
public <A extends Annotation> A getAnnotation(Class<A> acls)
PropertyWriter
getAnnotation
in interface BeanProperty
getAnnotation
in class PropertyWriter
public <A extends Annotation> A getContextAnnotation(Class<A> acls)
PropertyWriter
getContextAnnotation
in interface BeanProperty
getContextAnnotation
in class PropertyWriter
public void serializeAsField(Object map, JsonGenerator gen, SerializerProvider provider) throws IOException
PropertyWriter
serializeAsField
in class PropertyWriter
IOException
public void serializeAsOmittedField(Object map, JsonGenerator gen, SerializerProvider provider) throws Exception
PropertyWriter
serializeAsOmittedField
in class PropertyWriter
Exception
public void serializeAsElement(Object map, JsonGenerator gen, SerializerProvider provider) throws Exception
PropertyWriter
Collection
, array) types,
or POJOs using tabular
("as array") output format.
Note that this mode of operation is independent of underlying data format; so it is typically NOT called for fully tabular formats such as CSV, where logical output is still as form of POJOs.
serializeAsElement
in class PropertyWriter
Exception
public void serializeAsPlaceholder(Object value, JsonGenerator gen, SerializerProvider provider) throws Exception
PropertyWriter
PropertyWriter.serializeAsOmittedField(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)
.serializeAsPlaceholder
in class PropertyWriter
Exception
public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException
PropertyWriter
depositSchemaProperty
in interface BeanProperty
depositSchemaProperty
in class PropertyWriter
objectVisitor
- Visitor to used as the callback handlerJsonMappingException
@Deprecated public void depositSchemaProperty(ObjectNode propertiesNode, SerializerProvider provider) throws JsonMappingException
PropertyWriter
depositSchemaProperty
in class PropertyWriter
JsonMappingException
public JavaType getType()
BeanProperty
public PropertyName getWrapperName()
BeanProperty
public AnnotatedMember getMember()
BeanProperty
Copyright © 2008–2018 FasterXML. All rights reserved.