Class MapProperty
- java.lang.Object
-
- com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase
-
- com.fasterxml.jackson.databind.ser.PropertyWriter
-
- com.fasterxml.jackson.databind.ser.std.MapProperty
-
- All Implemented Interfaces:
BeanProperty
,Named
,java.io.Serializable
public class MapProperty extends PropertyWriter
Helper class needed to support flexible filtering of Map properties with generic JSON Filter functionality. SinceMap
s are not handled as a collection of properties by Jackson (unlike POJOs), bit more wrapping is required.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.fasterxml.jackson.databind.BeanProperty
BeanProperty.Bogus, BeanProperty.Std
-
-
Field Summary
-
Fields inherited from interface com.fasterxml.jackson.databind.BeanProperty
EMPTY_FORMAT, EMPTY_INCLUDE
-
-
Constructor Summary
Constructors Constructor Description MapProperty(TypeSerializer typeSer, BeanProperty prop)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method 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 java.lang.annotation.Annotation>
AgetAnnotation(java.lang.Class<A> acls)
Method for accessing annotations directly declared for property that this writer is associated with.<A extends java.lang.annotation.Annotation>
AgetContextAnnotation(java.lang.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.java.lang.String
getName()
Method to get logical name of the propertyJavaType
getType()
Method to get declared type of the property.java.lang.Object
getValue()
PropertyName
getWrapperName()
If property is indicated to be wrapped, name of wrapper element to use.void
reset(java.lang.Object key, JsonSerializer<java.lang.Object> keySer, JsonSerializer<java.lang.Object> valueSer)
Deprecated.void
reset(java.lang.Object key, java.lang.Object value, JsonSerializer<java.lang.Object> keySer, JsonSerializer<java.lang.Object> valueSer)
Initialization method that needs to be called before passing property to filter.void
serializeAsElement(java.lang.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(java.lang.Object map, JsonGenerator gen, SerializerProvider provider)
The main serialization method called by filter when property is to be written normally.void
serializeAsOmittedField(java.lang.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(java.lang.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(java.lang.Object v)
-
Methods inherited from class com.fasterxml.jackson.databind.ser.PropertyWriter
findAnnotation
-
Methods inherited from class com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase
findAliases, findFormatOverrides, findPropertyFormat, findPropertyInclusion, getMetadata, isRequired, isVirtual
-
-
-
-
Constructor Detail
-
MapProperty
public MapProperty(TypeSerializer typeSer, BeanProperty prop)
-
-
Method Detail
-
reset
public void reset(java.lang.Object key, java.lang.Object value, JsonSerializer<java.lang.Object> keySer, JsonSerializer<java.lang.Object> valueSer)
Initialization method that needs to be called before passing property to filter.- Since:
- 2.9
-
reset
@Deprecated public void reset(java.lang.Object key, JsonSerializer<java.lang.Object> keySer, JsonSerializer<java.lang.Object> valueSer)
Deprecated.
-
getName
public java.lang.String getName()
Description copied from interface:BeanProperty
Method to get logical name of the property- Specified by:
getName
in interfaceBeanProperty
- Specified by:
getName
in interfaceNamed
- Specified by:
getName
in classPropertyWriter
-
getValue
public java.lang.Object getValue()
- Since:
- 2.9
-
setValue
public void setValue(java.lang.Object v)
- Since:
- 2.9
-
getFullName
public PropertyName getFullName()
Description copied from interface:BeanProperty
Method for getting full name definition, including possible format-specific additional properties (such as namespace when using XML backend).- Specified by:
getFullName
in interfaceBeanProperty
- Specified by:
getFullName
in classPropertyWriter
-
getAnnotation
public <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> acls)
Description copied from class:PropertyWriter
Method for accessing annotations directly declared for property that this writer is associated with.- Specified by:
getAnnotation
in interfaceBeanProperty
- Specified by:
getAnnotation
in classPropertyWriter
-
getContextAnnotation
public <A extends java.lang.annotation.Annotation> A getContextAnnotation(java.lang.Class<A> acls)
Description copied from class:PropertyWriter
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.- Specified by:
getContextAnnotation
in interfaceBeanProperty
- Specified by:
getContextAnnotation
in classPropertyWriter
-
serializeAsField
public void serializeAsField(java.lang.Object map, JsonGenerator gen, SerializerProvider provider) throws java.io.IOException
Description copied from class:PropertyWriter
The main serialization method called by filter when property is to be written normally.- Specified by:
serializeAsField
in classPropertyWriter
- Throws:
java.io.IOException
-
serializeAsOmittedField
public void serializeAsOmittedField(java.lang.Object map, JsonGenerator gen, SerializerProvider provider) throws java.lang.Exception
Description copied from class:PropertyWriter
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. This is usually the case for tabular (positional) data formats such as CSV.- Specified by:
serializeAsOmittedField
in classPropertyWriter
- Throws:
java.lang.Exception
-
serializeAsElement
public void serializeAsElement(java.lang.Object map, JsonGenerator gen, SerializerProvider provider) throws java.lang.Exception
Description copied from class:PropertyWriter
Serialization method called when output is to be done as an array, that is, not using property names. This is needed when serializing container (Collection
, array) types, or POJOs usingtabular
("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.
- Specified by:
serializeAsElement
in classPropertyWriter
- Throws:
java.lang.Exception
-
serializeAsPlaceholder
public void serializeAsPlaceholder(java.lang.Object value, JsonGenerator gen, SerializerProvider provider) throws java.lang.Exception
Description copied from class:PropertyWriter
Serialization method called when doing tabular (positional) output from databind, but then value is to be omitted. This requires output of a placeholder value of some sort; often similar toPropertyWriter.serializeAsOmittedField(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)
.- Specified by:
serializeAsPlaceholder
in classPropertyWriter
- Throws:
java.lang.Exception
-
depositSchemaProperty
public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException
Description copied from class:PropertyWriter
Traversal method used for things like JSON Schema generation, or POJO introspection.- Specified by:
depositSchemaProperty
in interfaceBeanProperty
- Specified by:
depositSchemaProperty
in classPropertyWriter
- Parameters:
objectVisitor
- Visitor to used as the callback handler- Throws:
JsonMappingException
-
depositSchemaProperty
@Deprecated public void depositSchemaProperty(ObjectNode propertiesNode, SerializerProvider provider) throws JsonMappingException
Deprecated.Description copied from class:PropertyWriter
Legacy method called for JSON Schema generation; should not be called by new code- Specified by:
depositSchemaProperty
in classPropertyWriter
- Throws:
JsonMappingException
-
getType
public JavaType getType()
Description copied from interface:BeanProperty
Method to get declared type of the property.
-
getWrapperName
public PropertyName getWrapperName()
Description copied from interface:BeanProperty
If property is indicated to be wrapped, name of wrapper element to use.
-
getMember
public AnnotatedMember getMember()
Description copied from interface:BeanProperty
Method for accessing primary physical entity that represents the property; annotated field, method or constructor property.
-
-