- All Superinterfaces:
Snapshottable<PropertyFilter>
- All Known Implementing Classes:
SimpleBeanPropertyFilter,SimpleBeanPropertyFilter.FilterExceptFilter,SimpleBeanPropertyFilter.SerializeExceptFilter
Interface that defines API for filter objects use (as configured
using
JsonFilter)
for filtering bean properties to serialize.
Note that since this is an interface, it is
strongly recommended that custom implementations extend
SimpleBeanPropertyFilter,
to avoid backwards compatibility issues in case interface needs to change.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddepositSchemaProperty(PropertyWriter writer, JsonObjectFormatVisitor v, SerializationContext ctxt) Method called byBeanSerializerto let the filter determine whether, and in what form the given property exist within the parent, or root, schema.voidserializeAsElement(Object elementValue, JsonGenerator g, SerializationContext ctxt, PropertyWriter 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.voidserializeAsProperty(Object pojo, JsonGenerator g, SerializationContext ctxt, PropertyWriter writer) Method called byBeanSerializerto let the filter decide what to do with given bean property value: the usual choices are to either filter out (i.e.Methods inherited from interface tools.jackson.core.util.Snapshottable
snapshot
-
Method Details
-
serializeAsProperty
void serializeAsProperty(Object pojo, JsonGenerator g, SerializationContext ctxt, PropertyWriter writer) throws Exception Method called byBeanSerializerto 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 givenPropertyWriter, although filters can choose other to do something different altogether.Typical implementation is something like:
if (include(writer)) { writer.serializeAsProperty(pojo, gen, prov); }- Parameters:
pojo- Object that contains property value to serializeg- Generator use for serializing valuectxt- Provider that can be used for accessing dynamic aspects of serialization processingwriter- Object called to do actual serialization of the field, if not filtered out- Throws:
Exception
-
serializeAsElement
void serializeAsElement(Object elementValue, JsonGenerator g, SerializationContext ctxt, 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 givenPropertyWriter, 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 serializerdg- Generator use for serializing valuectxt- Provider that can be used for accessing dynamic aspects of serialization processingwriter- Object called to do actual serialization of the field, if not filtered out- Throws:
Exception
-
depositSchemaProperty
void depositSchemaProperty(PropertyWriter writer, JsonObjectFormatVisitor v, SerializationContext ctxt) Method called byBeanSerializerto 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 propertyTypical implementation is something like:
if (include(writer)) { writer.depositSchemaProperty(objectVisitor, provider); }- Parameters:
writer- Bean property serializer to use to create schema valuev- JsonObjectFormatVisitor which should be aware of the property's existencectxt- Serialization context
-