Class 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. Since Maps are not handled as a collection of properties by Jackson (unlike POJOs), bit more wrapping is required.
    See Also:
    Serialized Form
    • Field Detail

      • _key

        protected java.lang.Object _key
      • _value

        protected java.lang.Object _value
      • _keySerializer

        protected JsonSerializer<java.lang.Object> _keySerializer
      • _valueSerializer

        protected JsonSerializer<java.lang.Object> _valueSerializer
    • 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.
      • getValue

        public java.lang.Object getValue()
        Since:
        2.9
      • setValue

        public void setValue​(java.lang.Object v)
        Since:
        2.9
      • 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 interface BeanProperty
        Specified by:
        getAnnotation in class PropertyWriter
      • 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 interface BeanProperty
        Specified by:
        getContextAnnotation in class PropertyWriter
      • serializeAsField

        public void serializeAsField​(java.lang.Object map,
                                     com.fasterxml.jackson.core.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 class PropertyWriter
        Throws:
        java.io.IOException
      • serializeAsOmittedField

        public void serializeAsOmittedField​(java.lang.Object map,
                                            com.fasterxml.jackson.core.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 class PropertyWriter
        Throws:
        java.lang.Exception
      • serializeAsElement

        public void serializeAsElement​(java.lang.Object map,
                                       com.fasterxml.jackson.core.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 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:
        java.lang.Exception
      • 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.