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

public Class SimpleFilterProvider

extends FilterProvider
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.util.*, tools.jackson.core.util.Snapshottable, tools.jackson.databind.SerializationContext, tools.jackson.databind.ser.*, tools.jackson.databind.util.ClassUtil

Simple FilterProvider implementation that just stores direct id-to-filter mapping.

Field Summary

Modifier and TypeField and Description
protected boolean
_cfgFailOnUnknownId

Flag that indicates whether request for an unknown filter id should result an exception (default) or not.

protected PropertyFilter
_defaultFilter

This is the filter we return in case no mapping was found for given id; default is 'null' (in which case caller typically reports an error), but can be set to an explicit filter.

protected final Map<String, PropertyFilter>
_filtersById

Mappings from ids to filters.

private static final long

Constructor Summary

AccessConstructor and Description
public
public
SimpleFilterProvider(Map<String, PropertyFilter>
Mapping from id to filter; used as is if if possible
mapping
)

protected

Method Summary

Modifier and TypeMethod and Description
public SimpleFilterProvider

Returns:

This provider instance, for call-chaining
addFilter
(String
The id to associate the filter with.
id
,
PropertyFilter
The filter to add;
filter
)

Adds an instance of PropertyFilter associated with the given id parameter.

public SimpleFilterProvider

Returns:

This provider instance, for call-chaining
addFilter
(String
The id to associate the filter with.
id
,
SimpleBeanPropertyFilter
The filter to add;
filter
)

Overloaded variant just to resolve "ties" when using SimpleBeanPropertyFilter.

public PropertyFilter
findPropertyFilter(SerializationContext ctxt, Object filterId, Object valueToFilter)

Implements abstract tools.jackson.databind.ser.FilterProvider.findPropertyFilter.

Lookup method used to find PropertyFilter that has specified id. Note that id is typically a java.lang.String, but is not necessarily limited to that; that is, while standard components use String, custom implementation can choose other kinds of keys.

public PropertyFilter
public PropertyFilter
public SimpleFilterProvider
public SimpleFilterProvider
setDefaultFilter(SimpleBeanPropertyFilter f)

Overloaded variant just to resolve "ties" when using SimpleBeanPropertyFilter.

public SimpleFilterProvider
setFailOnUnknownId(boolean state)

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

public boolean

Field Detail

_cfgFailOnUnknownIdback to summary
protected boolean _cfgFailOnUnknownId

Flag that indicates whether request for an unknown filter id should result an exception (default) or not. Note that this is only relevant if no default filter has been configured.

_defaultFilterback to summary
protected PropertyFilter _defaultFilter

This is the filter we return in case no mapping was found for given id; default is 'null' (in which case caller typically reports an error), but can be set to an explicit filter.

_filtersByIdback to summary
protected final Map<String, PropertyFilter> _filtersById

Mappings from ids to filters.

serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

SimpleFilterProviderback to summary
public SimpleFilterProvider()
SimpleFilterProviderback to summary
public SimpleFilterProvider(Map<String, PropertyFilter> mapping)
Parameters
mapping:Map<String, PropertyFilter>

Mapping from id to filter; used as is if if possible

SimpleFilterProviderback to summary
protected SimpleFilterProvider(SimpleFilterProvider src)

Method Detail

addFilterback to summary
public SimpleFilterProvider addFilter(String id, PropertyFilter filter)

Adds an instance of PropertyFilter associated with the given id parameter. Note that there can always only be one filter associated with a single id parameter, meaning a new filter with the same id will always override the previously added filter.

Warning

Binding id or filter with null value will not be validated within this method, but during serialization of target class annotated with com.fasterxml.jackson.annotation.JsonFilter.

Parameters
id:String

The id to associate the filter with.

filter:PropertyFilter

The filter to add;

Returns:SimpleFilterProvider

This provider instance, for call-chaining

addFilterback to summary
public SimpleFilterProvider addFilter(String id, SimpleBeanPropertyFilter filter)

Overloaded variant just to resolve "ties" when using SimpleBeanPropertyFilter.

Adds an instance of SimpleBeanPropertyFilter associated with the given id parameter. Note that there can always only be one filter associated with a single id parameter, meaning a new filter with the same id will always override the previously added filter.

Warning

Binding id or filter with null value will not be validated within this method, but during serialization of target class annotated with com.fasterxml.jackson.annotation.JsonFilter.

Parameters
id:String

The id to associate the filter with.

filter:SimpleBeanPropertyFilter

The filter to add;

Returns:SimpleFilterProvider

This provider instance, for call-chaining

findPropertyFilterback to summary
public PropertyFilter findPropertyFilter(SerializationContext ctxt, Object filterId, Object valueToFilter)

Implements abstract tools.jackson.databind.ser.FilterProvider.findPropertyFilter.

Doc from tools.jackson.databind.ser.FilterProvider.findPropertyFilter.

Lookup method used to find PropertyFilter that has specified id. Note that id is typically a java.lang.String, but is not necessarily limited to that; that is, while standard components use String, custom implementation can choose other kinds of keys.

Annotations
@Override
getDefaultFilterback to summary
public PropertyFilter getDefaultFilter()
removeFilterback to summary
public PropertyFilter removeFilter(String id)
setDefaultFilterback to summary
public SimpleFilterProvider setDefaultFilter(PropertyFilter f)
setDefaultFilterback to summary
public SimpleFilterProvider setDefaultFilter(SimpleBeanPropertyFilter f)

Overloaded variant just to resolve "ties" when using SimpleBeanPropertyFilter.

setFailOnUnknownIdback to summary
public SimpleFilterProvider setFailOnUnknownId(boolean state)
snapshotback to summary
public SimpleFilterProvider 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
willFailOnUnknownIdback to summary
public boolean willFailOnUnknownId()