com.fasterxml.jackson.databind.ser.std

## Class MapProperty

- java.lang.Object
- - com.fasterxml.jackson.databind.ser.PropertyWriter
  - - com.fasterxml.jackson.databind.ser.std.MapProperty

-     public class MapProperty
      extends PropertyWriter

  Helper class needed to support flexible filtering of Map properties with generic JSON Filter functionality. Since `Map`s are not handled as a collection of properties by Jackson (unlike POJOs), bit more wrapping is required.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Object` | `_key`
    `protected JsonSerializer<Object>` | `_keySerializer`
    `protected BeanProperty` | `_property`
    `protected TypeSerializer` | `_typeSerializer`
    `protected JsonSerializer<Object>` | `_valueSerializer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MapProperty(TypeSerializer typeSer)` Deprecated. since 2.4
    `MapProperty(TypeSerializer typeSer, BeanProperty prop)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `depositSchemaProperty(JsonObjectFormatVisitor objectVisitor)` Traversal method used for things like JSON Schema generation, or POJO introspection.
    `void` | `depositSchemaProperty(ObjectNode propertiesNode, SerializerProvider provider)` Deprecated.
    `<A extends Annotation> A` | `getAnnotation(Class<A> acls)` Method for accessing annotations directly declared for property that this writer is associated with.
    `<A extends Annotation> A` | `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()`
    `String` | `getName()`
    `void` | `reset(Object key, JsonSerializer<Object> keySer, JsonSerializer<Object> valueSer)` Initialization method that needs to be called before passing property to filter.
    `void` | `serializeAsElement(Object value, com.fasterxml.jackson.core.JsonGenerator jgen, SerializerProvider provider)` Serialization method called when output is to be done as an array, that is, not using property names.
    `void` | `serializeAsField(Object value, com.fasterxml.jackson.core.JsonGenerator jgen, SerializerProvider provider)` The main serialization method called by filter when property is to be written normally.
    `void` | `serializeAsOmittedField(Object value, com.fasterxml.jackson.core.JsonGenerator jgen, 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, com.fasterxml.jackson.core.JsonGenerator jgen, SerializerProvider provider)` Serialization method called when doing tabular (positional) output from databind, but then value is to be omitted.

    - ### Methods inherited from class com.fasterxml.jackson.databind.ser.PropertyWriter

      `findAnnotation`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### _typeSerializer

          protected final TypeSerializer _typeSerializer

    - #### _property

          protected final BeanProperty _property

    - #### _key

          protected Object _key

    - #### _keySerializer

          protected JsonSerializer<Object> _keySerializer

    - #### _valueSerializer

          protected JsonSerializer<Object> _valueSerializer

  - ### Constructor Detail

    - #### MapProperty

          @Deprecated
          public MapProperty(TypeSerializer typeSer)

      Deprecated. since 2.4

    - #### MapProperty

          public MapProperty(TypeSerializer typeSer,
                             BeanProperty prop)

  - ### Method Detail

    - #### reset

          public void reset(Object key,
                            JsonSerializer<Object> keySer,
                            JsonSerializer<Object> valueSer)

      Initialization method that needs to be called before passing property to filter.

    - #### getName

          public String getName()

      Specified by:
        `getName` in class `PropertyWriter`

    - #### getFullName

          public PropertyName getFullName()

      Specified by:
        `getFullName` in class `PropertyWriter`

    - #### getAnnotation

          public <A extends Annotation> A getAnnotation(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 class `PropertyWriter`

    - #### getContextAnnotation

          public <A extends Annotation> A getContextAnnotation(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 class `PropertyWriter`

    - #### serializeAsField

          public void serializeAsField(Object value,
                                       com.fasterxml.jackson.core.JsonGenerator jgen,
                                       SerializerProvider provider)
                                throws IOException

      Description copied from class: `PropertyWriter`
      The main serialization method called by filter when property is to be written normally.
      Specified by:
        `serializeAsField` in class `PropertyWriter`
      Throws:
        `IOException`

    - #### serializeAsOmittedField

          public void serializeAsOmittedField(Object value,
                                              com.fasterxml.jackson.core.JsonGenerator jgen,
                                              SerializerProvider provider)
                                       throws 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 class `PropertyWriter`
      Throws:
        `Exception`

    - #### serializeAsElement

          public void serializeAsElement(Object value,
                                         com.fasterxml.jackson.core.JsonGenerator jgen,
                                         SerializerProvider provider)
                                  throws 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 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.

      Specified by:
        `serializeAsElement` in class `PropertyWriter`
      Throws:
        `Exception`

    - #### serializeAsPlaceholder

          public void serializeAsPlaceholder(Object value,
                                             com.fasterxml.jackson.core.JsonGenerator jgen,
                                             SerializerProvider provider)
                                      throws 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 to `PropertyWriter.serializeAsOmittedField(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider)`.
      Specified by:
        `serializeAsPlaceholder` in class `PropertyWriter`
      Throws:
        `Exception`

    - #### depositSchemaProperty

          public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor)
                                     throws JsonMappingException

      Description copied from class: `PropertyWriter`
      Traversal method used for things like JSON Schema generation, or POJO introspection.
      Specified by:
        `depositSchemaProperty` in class `PropertyWriter`
      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 class `PropertyWriter`
      Throws:
        `JsonMappingException`

Copyright © 2014–2015 FasterXML. All rights reserved.