Interface PropertyFilter

    • Method Detail

      • serializeAsField

        void serializeAsField​(java.lang.Object pojo,
                              JsonGenerator gen,
                              SerializerProvider prov,
                              PropertyWriter writer)
                       throws java.lang.Exception
        Method called by BeanSerializer to let the filter decide what to do with given bean property value: the usual choices are to either filter out (i.e. do nothing) or write using given PropertyWriter, although filters can choose other to do something different altogether.

        Typical implementation is something like:

         if (include(writer)) {
              writer.serializeAsField(pojo, gen, prov);
         }
        
        Parameters:
        pojo - Object that contains property value to serialize
        gen - Generator use for serializing value
        prov - Provider that can be used for accessing dynamic aspects of serialization processing
        writer - Object called to do actual serialization of the field, if not filtered out
        Throws:
        java.lang.Exception
      • serializeAsElement

        void serializeAsElement​(java.lang.Object elementValue,
                                JsonGenerator gen,
                                SerializerProvider prov,
                                PropertyWriter writer)
                         throws java.lang.Exception
        Method called by container to let the filter decide what to do with given element value: the usual choices are to either filter out (i.e. do nothing) or write using given PropertyWriter, although filters can choose other to do something different altogether.

        Typical implementation is something like:

         if (include(writer)) {
              writer.serializeAsElement(pojo, gen, prov);
         }
        
        Parameters:
        elementValue - Element value being serializerd
        gen - Generator use for serializing value
        prov - Provider that can be used for accessing dynamic aspects of serialization processing
        writer - Object called to do actual serialization of the field, if not filtered out
        Throws:
        java.lang.Exception
      • depositSchemaProperty

        @Deprecated
        void depositSchemaProperty​(PropertyWriter writer,
                                   ObjectNode propertiesNode,
                                   SerializerProvider provider)
                            throws JsonMappingException
        Deprecated.
        Since 2.3: new code should use the alternative depositSchemaProperty method
        Method called by BeanSerializer to let the filter determine whether, and in what form the given property exist within the parent, or root, schema. Filters can omit adding the property to the node, or choose the form of the schema value for the property.

        Typical implementation is something like:

         if (include(writer)) {
              writer.depositSchemaProperty(propertiesNode, provider);
         }
        
        Parameters:
        writer - Bean property writer to use to create schema value
        propertiesNode - Node which the given property would exist within
        provider - Provider that can be used for accessing dynamic aspects of serialization processing
        Throws:
        JsonMappingException
      • depositSchemaProperty

        void depositSchemaProperty​(PropertyWriter writer,
                                   JsonObjectFormatVisitor objectVisitor,
                                   SerializerProvider provider)
                            throws JsonMappingException
        Method called by BeanSerializer to let the filter determine whether, and in what form the given property exist within the parent, or root, schema. Filters can omit adding the property to the node, or choose the form of the schema value for the property

        Typical implementation is something like:

         if (include(writer)) {
              writer.depositSchemaProperty(objectVisitor, provider);
         }
        
        Parameters:
        writer - Bean property serializer to use to create schema value
        objectVisitor - JsonObjectFormatVisitor which should be aware of the property's existence
        provider - Provider that can be used for accessing dynamic aspects of serialization processing
        Throws:
        JsonMappingException