Top Description Methods
com.fasterxml.jackson.databind.ser

public Interface PropertyFilter

Known Direct Implementers
com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter
Imports
com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.JsonMappingException, .SerializerProvider, com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor, com.fasterxml.jackson.databind.node.ObjectNode

Interface that defines API for filter objects use (as configured using com.fasterxml.jackson.annotation.JsonFilter) for filtering bean properties to serialize.

Note that this is the replacement for BeanPropertyFilter, which is replaced because it was too closely bound to Bean properties and would not work with java.util.Maps or "any getters".

Note that since this is an interface, it is strongly recommended that custom implementations extend com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter, to avoid backwards compatibility issues in case interface needs to change.

Since
2.3

Method Summary

Modifier and TypeMethod and Description
public void
depositSchemaProperty(PropertyWriter
Bean property writer to use to create schema value
writer
,
ObjectNode
Node which the given property would exist within
propertiesNode
,
SerializerProvider
Provider that can be used for accessing dynamic aspects of serialization processing
provider
)
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.

public void
depositSchemaProperty(PropertyWriter
Bean property serializer to use to create schema value
writer
,
JsonObjectFormatVisitor
JsonObjectFormatVisitor which should be aware of the property's existence
objectVisitor
,
SerializerProvider
Provider that can be used for accessing dynamic aspects of serialization processing
provider
)

Method called by BeanSerializer to let the filter determine whether, and in what form the given property exist within the parent, or root, schema.

public void
serializeAsElement(Object
Element value being serializerd
elementValue
,
JsonGenerator
Generator use for serializing value
gen
,
SerializerProvider
Provider that can be used for accessing dynamic aspects of serialization processing
prov
,
PropertyWriter
Object called to do actual serialization of the field, if not filtered out
writer
)

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.

public void
serializeAsField(Object
Object that contains property value to serialize
pojo
,
JsonGenerator
Generator use for serializing value
gen
,
SerializerProvider
Provider that can be used for accessing dynamic aspects of serialization processing
prov
,
PropertyWriter
Object called to do actual serialization of the field, if not filtered out
writer
)

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.

Method Detail

depositSchemaPropertyback to summary
public 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:PropertyWriter

Bean property writer to use to create schema value

propertiesNode:ObjectNode

Node which the given property would exist within

provider:SerializerProvider

Provider that can be used for accessing dynamic aspects of serialization processing

Annotations
@Deprecated
depositSchemaPropertyback to summary
public 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:PropertyWriter

Bean property serializer to use to create schema value

objectVisitor:JsonObjectFormatVisitor

JsonObjectFormatVisitor which should be aware of the property's existence

provider:SerializerProvider

Provider that can be used for accessing dynamic aspects of serialization processing

serializeAsElementback to summary
public void serializeAsElement(Object elementValue, JsonGenerator gen, SerializerProvider prov, PropertyWriter writer) throws 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:Object

Element value being serializerd

gen:JsonGenerator

Generator use for serializing value

prov:SerializerProvider

Provider that can be used for accessing dynamic aspects of serialization processing

writer:PropertyWriter

Object called to do actual serialization of the field, if not filtered out

serializeAsFieldback to summary
public void serializeAsField(Object pojo, JsonGenerator gen, SerializerProvider prov, PropertyWriter writer) throws 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

Object that contains property value to serialize

gen:JsonGenerator

Generator use for serializing value

prov:SerializerProvider

Provider that can be used for accessing dynamic aspects of serialization processing

writer:PropertyWriter

Object called to do actual serialization of the field, if not filtered out