public class SimpleBeanPropertyFilter extends java.lang.Object implements BeanPropertyFilter, PropertyFilter
PropertyFilter
implementation that only uses property name
to determine whether to serialize property as is, or to filter it out.
Use of this class as the base implementation for any custom
PropertyFilter
implementations is strongly encouraged,
because it can provide default implementation for any methods that may
be added in PropertyFilter
(as unfortunate as additions may be).
Modifier and Type | Class and Description |
---|---|
static class |
SimpleBeanPropertyFilter.FilterExceptFilter
Filter implementation which defaults to filtering out unknown
properties and only serializes ones explicitly listed.
|
static class |
SimpleBeanPropertyFilter.SerializeExceptFilter
Filter implementation which defaults to serializing all
properties, except for ones explicitly listed to be filtered out.
|
Modifier and Type | Method and Description |
---|---|
void |
depositSchemaProperty(BeanPropertyWriter writer,
JsonObjectFormatVisitor objectVisitor,
SerializerProvider provider)
Deprecated.
|
void |
depositSchemaProperty(BeanPropertyWriter writer,
ObjectNode propertiesNode,
SerializerProvider provider)
Deprecated.
|
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.
|
static SimpleBeanPropertyFilter |
filterOutAllExcept(java.util.Set<java.lang.String> properties)
Factory method to construct filter that filters out all properties except
ones includes in set
|
static SimpleBeanPropertyFilter |
filterOutAllExcept(java.lang.String... propertyArray) |
static PropertyFilter |
from(BeanPropertyFilter src)
Helper method to ease transition from
BeanPropertyWriter into
PropertyWriter |
static SimpleBeanPropertyFilter |
serializeAll()
Convenience factory method that will return a "no-op" filter that will
simply just serialize all properties that are given, and filter out
nothing.
|
static SimpleBeanPropertyFilter |
serializeAll(java.util.Set<java.lang.String> properties)
Deprecated.
Since 2.6; to be removed from 2.7
|
static SimpleBeanPropertyFilter |
serializeAllExcept(java.util.Set<java.lang.String> properties) |
static SimpleBeanPropertyFilter |
serializeAllExcept(java.lang.String... propertyArray) |
void |
serializeAsElement(java.lang.Object elementValue,
JsonGenerator jgen,
SerializerProvider provider,
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(java.lang.Object bean,
JsonGenerator jgen,
SerializerProvider provider,
BeanPropertyWriter writer)
Deprecated.
|
void |
serializeAsField(java.lang.Object pojo,
JsonGenerator jgen,
SerializerProvider provider,
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. |
public static SimpleBeanPropertyFilter serializeAll()
@Deprecated public static SimpleBeanPropertyFilter serializeAll(java.util.Set<java.lang.String> properties)
filterOutAllExcept(Set)
which is not
very useful. Instead, see serializeAll()
for intended signature.public static SimpleBeanPropertyFilter filterOutAllExcept(java.util.Set<java.lang.String> properties)
public static SimpleBeanPropertyFilter filterOutAllExcept(java.lang.String... propertyArray)
public static SimpleBeanPropertyFilter serializeAllExcept(java.util.Set<java.lang.String> properties)
public static SimpleBeanPropertyFilter serializeAllExcept(java.lang.String... propertyArray)
public static PropertyFilter from(BeanPropertyFilter src)
BeanPropertyWriter
into
PropertyWriter
@Deprecated public void serializeAsField(java.lang.Object bean, JsonGenerator jgen, SerializerProvider provider, BeanPropertyWriter writer) throws java.lang.Exception
BeanPropertyFilter
BeanSerializer
to let 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 BeanPropertyWriter
, although filters
can choose other to do something different altogether.
Typical implementation is something like:
if (include(writer)) { writer.serializeAsField(pojo, jgen, prov); }
serializeAsField
in interface BeanPropertyFilter
bean
- Object that contains property value to serializejgen
- Generator use for serializing valueprovider
- Provider that can be used for accessing dynamic aspects of serialization
processingwriter
- Default bean property serializer to usejava.lang.Exception
@Deprecated public void depositSchemaProperty(BeanPropertyWriter writer, ObjectNode propertiesNode, SerializerProvider provider) throws JsonMappingException
BeanPropertyFilter
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); }
depositSchemaProperty
in interface BeanPropertyFilter
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
@Deprecated public void depositSchemaProperty(BeanPropertyWriter writer, JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException
BeanPropertyFilter
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); }
depositSchemaProperty
in interface BeanPropertyFilter
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
public void serializeAsField(java.lang.Object pojo, JsonGenerator jgen, SerializerProvider provider, PropertyWriter writer) throws java.lang.Exception
PropertyFilter
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); }
serializeAsField
in interface PropertyFilter
pojo
- Object that contains property value to serializejgen
- Generator use for serializing valueprovider
- Provider that can be used for accessing dynamic aspects of serialization
processingwriter
- Object called to do actual serialization of the field, if not filtered outjava.lang.Exception
public void serializeAsElement(java.lang.Object elementValue, JsonGenerator jgen, SerializerProvider provider, PropertyWriter writer) throws java.lang.Exception
PropertyFilter
PropertyWriter
, although filters
can choose other to do something different altogether.
Typical implementation is something like:
if (include(writer)) { writer.serializeAsElement(pojo, gen, prov); }
serializeAsElement
in interface PropertyFilter
elementValue
- Element value being serializerdjgen
- Generator use for serializing valueprovider
- Provider that can be used for accessing dynamic aspects of serialization
processingwriter
- Object called to do actual serialization of the field, if not filtered outjava.lang.Exception
@Deprecated public void depositSchemaProperty(PropertyWriter writer, ObjectNode propertiesNode, SerializerProvider provider) throws JsonMappingException
PropertyFilter
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); }
depositSchemaProperty
in interface PropertyFilter
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
public void depositSchemaProperty(PropertyWriter writer, JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException
PropertyFilter
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); }
depositSchemaProperty
in interface PropertyFilter
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 © 2010 - 2020 Adobe. All Rights Reserved