Top Description Inners Constructors Methods
tools.jackson.databind.ser.std

public Class SimpleBeanPropertyFilter

extends Object
implements PropertyFilter
Class Inheritance
All Implemented Interfaces
tools.jackson.databind.ser.PropertyFilter, tools.jackson.core.util.Snapshottable
Known Direct Subclasses
tools.jackson.databind.ser.std.SimpleBeanPropertyFilter.FilterExceptFilter, tools.jackson.databind.ser.std.SimpleBeanPropertyFilter.SerializeExceptFilter
Imports
java.util.*, tools.jackson.core.JsonGenerator, tools.jackson.databind.*, tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor, tools.jackson.databind.ser.*

Simple 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).

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
SimpleBeanPropertyFilter.FilterExceptFilter

Filter implementation which defaults to filtering out unknown properties and only serializes ones explicitly listed.

public static class
SimpleBeanPropertyFilter.SerializeExceptFilter

Filter implementation which defaults to serializing all properties, except for ones explicitly listed to be filtered out.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
depositSchemaProperty(PropertyWriter writer, JsonObjectFormatVisitor objectVisitor, SerializationContext provider)

Implements tools.jackson.databind.ser.PropertyFilter.depositSchemaProperty.

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 static SimpleBeanPropertyFilter
filterOutAll()

Convenience factory method that will return a filter that will simply filter out everything.

public static SimpleBeanPropertyFilter
filterOutAllExcept(Set<String> properties)

Factory method to construct filter that filters out all properties except ones includes in set

public static SimpleBeanPropertyFilter
filterOutAllExcept(String... propertyArray)

protected boolean
include(BeanPropertyWriter writer)

Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)

protected boolean
include(PropertyWriter writer)

Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)

protected boolean
includeElement(Object elementValue)

Method that defines what to do with container elements (values contained in an array or java.util.Collection: default implementation simply writes them out.

public 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.

public static SimpleBeanPropertyFilter
public static SimpleBeanPropertyFilter
serializeAllExcept(String... propertyArray)

public void
serializeAsElement(Object elementValue, JsonGenerator g, SerializationContext provider, PropertyWriter writer)

Implements tools.jackson.databind.ser.PropertyFilter.serializeAsElement.

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
serializeAsProperty(Object pojo, JsonGenerator g, SerializationContext provider, PropertyWriter writer)

Implements tools.jackson.databind.ser.PropertyFilter.serializeAsProperty.

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.

public PropertyFilter
snapshot()

Implements tools.jackson.core.util.Snapshottable.snapshot.

Method to call to get an instance that may not be modified through any other object, including `this`.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SimpleBeanPropertyFilterback to summary
protected SimpleBeanPropertyFilter()

Method Detail

depositSchemaPropertyback to summary
public void depositSchemaProperty(PropertyWriter writer, JsonObjectFormatVisitor objectVisitor, SerializationContext provider)

Implements tools.jackson.databind.ser.PropertyFilter.depositSchemaProperty.

Doc from tools.jackson.databind.ser.PropertyFilter.depositSchemaProperty.

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);
 }
Annotations
@Override
filterOutAllback to summary
public static SimpleBeanPropertyFilter filterOutAll()

Convenience factory method that will return a filter that will simply filter out everything.

filterOutAllExceptback to summary
public static SimpleBeanPropertyFilter filterOutAllExcept(Set<String> properties)

Factory method to construct filter that filters out all properties except ones includes in set

filterOutAllExceptback to summary
public static SimpleBeanPropertyFilter filterOutAllExcept(String... propertyArray)
includeback to summary
protected boolean include(BeanPropertyWriter writer)

Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)

includeback to summary
protected boolean include(PropertyWriter writer)

Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)

includeElementback to summary
protected boolean includeElement(Object elementValue)

Method that defines what to do with container elements (values contained in an array or java.util.Collection: default implementation simply writes them out.

serializeAllback to summary
public 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.

serializeAllExceptback to summary
public static SimpleBeanPropertyFilter serializeAllExcept(Set<String> properties)
serializeAllExceptback to summary
public static SimpleBeanPropertyFilter serializeAllExcept(String... propertyArray)
serializeAsElementback to summary
public void serializeAsElement(Object elementValue, JsonGenerator g, SerializationContext provider, PropertyWriter writer) throws Exception

Implements tools.jackson.databind.ser.PropertyFilter.serializeAsElement.

Doc from tools.jackson.databind.ser.PropertyFilter.serializeAsElement.

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);
 }
Annotations
@Override
serializeAsPropertyback to summary
public void serializeAsProperty(Object pojo, JsonGenerator g, SerializationContext provider, PropertyWriter writer) throws Exception

Implements tools.jackson.databind.ser.PropertyFilter.serializeAsProperty.

Doc from tools.jackson.databind.ser.PropertyFilter.serializeAsProperty.

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.serializeAsProperty(pojo, gen, prov);
 }
Annotations
@Override
snapshotback to summary
public PropertyFilter snapshot()

Implements tools.jackson.core.util.Snapshottable.snapshot.

Doc from tools.jackson.core.util.Snapshottable.snapshot.

Method to call to get an instance that may not be modified through any other object, including `this`. That instance may be `this` if (and only if) this instance is effectively immutable (unmodifiable) through its API: if this is not the case, a new copy with same configuration must be created and returned.

Annotations
@Override
tools.jackson.databind.ser.std back to summary

public Class SimpleBeanPropertyFilter.FilterExceptFilter

extends SimpleBeanPropertyFilter
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable

Filter implementation which defaults to filtering out unknown properties and only serializes ones explicitly listed.

Field Summary

Modifier and TypeField and Description
protected final Set<String>
_propertiesToInclude

Set of property names to serialize.

pack-priv static final SimpleBeanPropertyFilter.FilterExceptFilter
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected boolean
include(BeanPropertyWriter writer)

Overrides tools.jackson.databind.ser.std.SimpleBeanPropertyFilter.include.

Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)

protected boolean
include(PropertyWriter writer)

Overrides tools.jackson.databind.ser.std.SimpleBeanPropertyFilter.include.

Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)

Inherited from tools.jackson.databind.ser.std.SimpleBeanPropertyFilter:
depositSchemaPropertyfilterOutAllfilterOutAllExceptfilterOutAllExceptincludeElementserializeAllserializeAllExceptserializeAllExceptserializeAsElementserializeAsPropertysnapshot

Field Detail

_propertiesToIncludeback to summary
protected final Set<String> _propertiesToInclude

Set of property names to serialize.

EXCLUDE_ALLback to summary
pack-priv static final SimpleBeanPropertyFilter.FilterExceptFilter EXCLUDE_ALL
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

FilterExceptFilterback to summary
public FilterExceptFilter(Set<String> properties)

Method Detail

includeback to summary
protected boolean include(BeanPropertyWriter writer)

Overrides tools.jackson.databind.ser.std.SimpleBeanPropertyFilter.include.

Doc from tools.jackson.databind.ser.std.SimpleBeanPropertyFilter.include.

Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)

Annotations
@Override
includeback to summary
protected boolean include(PropertyWriter writer)

Overrides tools.jackson.databind.ser.std.SimpleBeanPropertyFilter.include.

Doc from tools.jackson.databind.ser.std.SimpleBeanPropertyFilter.include.

Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)

Annotations
@Override
tools.jackson.databind.ser.std back to summary

public Class SimpleBeanPropertyFilter.SerializeExceptFilter

extends SimpleBeanPropertyFilter
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable

Filter implementation which defaults to serializing all properties, except for ones explicitly listed to be filtered out.

Field Summary

Modifier and TypeField and Description
protected final Set<String>
_propertiesToExclude

Set of property names to filter out.

pack-priv static final SimpleBeanPropertyFilter.SerializeExceptFilter
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected boolean
include(BeanPropertyWriter writer)

Overrides tools.jackson.databind.ser.std.SimpleBeanPropertyFilter.include.

Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)

protected boolean
include(PropertyWriter writer)

Overrides tools.jackson.databind.ser.std.SimpleBeanPropertyFilter.include.

Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)

Inherited from tools.jackson.databind.ser.std.SimpleBeanPropertyFilter:
depositSchemaPropertyfilterOutAllfilterOutAllExceptfilterOutAllExceptincludeElementserializeAllserializeAllExceptserializeAllExceptserializeAsElementserializeAsPropertysnapshot

Field Detail

_propertiesToExcludeback to summary
protected final Set<String> _propertiesToExclude

Set of property names to filter out.

INCLUDE_ALLback to summary
pack-priv static final SimpleBeanPropertyFilter.SerializeExceptFilter INCLUDE_ALL
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

SerializeExceptFilterback to summary
public SerializeExceptFilter(Set<String> properties)

Method Detail

includeback to summary
protected boolean include(BeanPropertyWriter writer)

Overrides tools.jackson.databind.ser.std.SimpleBeanPropertyFilter.include.

Doc from tools.jackson.databind.ser.std.SimpleBeanPropertyFilter.include.

Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)

Annotations
@Override
includeback to summary
protected boolean include(PropertyWriter writer)

Overrides tools.jackson.databind.ser.std.SimpleBeanPropertyFilter.include.

Doc from tools.jackson.databind.ser.std.SimpleBeanPropertyFilter.include.

Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)

Annotations
@Override