public class SimpleFilterProvider extends FilterProvider implements Serializable
FilterProvider
implementation that just stores
direct id-to-filter mapping.
Note that version 2.3 was a partial rewrite, now that
PropertyFilter
is set to replace BeanPropertyFilter
.
Modifier and Type | Field 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 Map<String,PropertyFilter> |
_filtersById
Mappings from ids to filters.
|
Constructor and Description |
---|
SimpleFilterProvider() |
SimpleFilterProvider(Map<String,?> mapping) |
protected final Map<String,PropertyFilter> _filtersById
protected PropertyFilter _defaultFilter
protected boolean _cfgFailOnUnknownId
@Deprecated public SimpleFilterProvider setDefaultFilter(BeanPropertyFilter f)
PropertyFilter
instead of BeanPropertyFilter
f
- Filter to return when no filter is found for given idpublic SimpleFilterProvider setDefaultFilter(PropertyFilter f)
public SimpleFilterProvider setDefaultFilter(SimpleBeanPropertyFilter f)
SimpleBeanPropertyFilter
.public PropertyFilter getDefaultFilter()
public SimpleFilterProvider setFailOnUnknownId(boolean state)
public boolean willFailOnUnknownId()
@Deprecated public SimpleFilterProvider addFilter(String id, BeanPropertyFilter filter)
public SimpleFilterProvider addFilter(String id, PropertyFilter filter)
public SimpleFilterProvider addFilter(String id, SimpleBeanPropertyFilter filter)
SimpleBeanPropertyFilter
.public PropertyFilter removeFilter(String id)
@Deprecated public BeanPropertyFilter findFilter(Object filterId)
FilterProvider
BeanPropertyFilter
that has specified id.
Note that id is typically a String
, but is not necessarily
limited to that; that is, while standard components use String, custom
implementation can choose other kinds of keys.findFilter
in class FilterProvider
public PropertyFilter findPropertyFilter(Object filterId, Object valueToFilter)
FilterProvider
PropertyFilter
that has specified id.
Note that id is typically a String
, but is not necessarily
limited to that; that is, while standard components use String, custom
implementation can choose other kinds of keys.
This method is the replacement for FilterProvider.findFilter(java.lang.Object)
starting with 2.3.
Note that the default implementation is designed to support short-term
backwards compatibility, and will call the deprecated findFilter
method, then wrap filter if one found as PropertyFilter
.
It should be overridden by up-to-date implementations
findPropertyFilter
in class FilterProvider
filterId
- Id of the filter to fetchvalueToFilter
- Object being filtered (usually POJO, but may be a Map
,
or in future a container), if available; not available when generating
schemas.Copyright © 2019 JBoss by Red Hat. All rights reserved.