public interface PropertyFilter
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 Map
s or "any getters".
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.
Modifier and Type | Method and Description |
---|---|
void |
depositSchemaProperty(PropertyWriter writer,
JsonObjectFormatVisitor objectVisitor,
SerializerProvider 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. |
void |
depositSchemaProperty(PropertyWriter writer,
ObjectNode propertiesNode,
SerializerProvider provider)
Deprecated.
Since 2.3: new code should use the alternative
depositSchemaProperty
method |
void |
serializeAsElement(Object elementValue,
JsonGenerator jgen,
SerializerProvider prov,
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.
|
void |
serializeAsField(Object pojo,
JsonGenerator jgen,
SerializerProvider prov,
PropertyWriter 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. |
void serializeAsField(Object pojo, JsonGenerator jgen, SerializerProvider prov, PropertyWriter writer) throws Exception
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, jgen, prov); }
pojo
- Object that contains property value to serializejgen
- Generator use for serializing valueprov
- Provider that can be used for accessing dynamic aspects of serialization
processingwriter
- Object called to do actual serialization of the field, if not filtered outException
void serializeAsElement(Object elementValue, JsonGenerator jgen, SerializerProvider prov, PropertyWriter writer) throws Exception
PropertyWriter
, although filters
can choose other to do something different altogether.
Typical implementation is something like:
if (include(writer)) { writer.serializeAsElement(pojo, jgen, prov); }
elementValue
- Element value being serializerdjgen
- Generator use for serializing valueprov
- Provider that can be used for accessing dynamic aspects of serialization
processingwriter
- Object called to do actual serialization of the field, if not filtered outException
@Deprecated void depositSchemaProperty(PropertyWriter writer, ObjectNode propertiesNode, SerializerProvider provider) throws JsonMappingException
depositSchemaProperty
methodBeanSerializer
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); }
writer
- Bean property writer to use to create schema valuepropertiesNode
- Node which the given property would exist withinprovider
- Provider that can be used for accessing dynamic aspects of serialization
processingJsonMappingException
void depositSchemaProperty(PropertyWriter writer, JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException
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); }
writer
- Bean property serializer to use to create schema valueobjectVisitor
- JsonObjectFormatVisitor which should be aware of
the property's existenceprovider
- Provider that can be used for accessing dynamic aspects of serialization
processingJsonMappingException
Copyright © 2017 JBoss by Red Hat. All rights reserved.