Class SimpleFilterProvider
java.lang.Object
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.ser.FilterProvider
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider
- All Implemented Interfaces:
Serializable
Simple
FilterProvider
implementation that just stores
direct id-to-filter mapping. It also allows specifying a
"default" filter to return if no registered instance matches
given filter id.
Note that version 2.3 was a partial rewrite, now that
PropertyFilter
is set to replace BeanPropertyFilter
.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Flag that indicates whether request for an unknown filter id should result an exception (default) or not.protected PropertyFilter
This is the filter we return in case no mapping was found for given id; default isnull
(in which case caller typically reports an error), but can be set to an explicit filter.protected final Map<String,
PropertyFilter> Mappings from ids to filters. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddFilter
(String id, BeanPropertyFilter filter) Deprecated.since 2.3addFilter
(String id, SimpleBeanPropertyFilter filter) Overloaded variant just to resolve "ties" when usingSimpleBeanPropertyFilter
.addFilter
(String id, PropertyFilter filter) findFilter
(Object filterId) Deprecated.findPropertyFilter
(Object filterId, Object valueToFilter) Lookup method used to findPropertyFilter
that has specified id.removeFilter
(String id) Deprecated.Since 2.3 should usePropertyFilter
instead ofBeanPropertyFilter
Overloaded variant just to resolve "ties" when usingSimpleBeanPropertyFilter
.Method for defining "default filter" to use, if any (null
if none), to return in case no registered instance matches passed filter id.setFailOnUnknownId
(boolean state) boolean
-
Field Details
-
_filtersById
Mappings from ids to filters. -
_defaultFilter
This is the filter we return in case no mapping was found for given id; default isnull
(in which case caller typically reports an error), but can be set to an explicit filter. -
_cfgFailOnUnknownId
protected boolean _cfgFailOnUnknownIdFlag 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.
-
-
Constructor Details
-
SimpleFilterProvider
public SimpleFilterProvider() -
SimpleFilterProvider
- Parameters:
mapping
- Mapping from id to filter; used as is if if possible
-
-
Method Details
-
setDefaultFilter
Deprecated.Since 2.3 should usePropertyFilter
instead ofBeanPropertyFilter
Method for defining filter to return for "unknown" filters; cases where there is no mapping from given id to an explicit filter.- Parameters:
f
- Filter to return when no filter is found for given id
-
setDefaultFilter
Method for defining "default filter" to use, if any (null
if none), to return in case no registered instance matches passed filter id.- Parameters:
f
- Default filter to set- Returns:
- This provider instance, for call-chaining
-
setDefaultFilter
Overloaded variant just to resolve "ties" when usingSimpleBeanPropertyFilter
. -
getDefaultFilter
-
setFailOnUnknownId
-
willFailOnUnknownId
public boolean willFailOnUnknownId() -
addFilter
Deprecated.since 2.3 -
addFilter
-
addFilter
Overloaded variant just to resolve "ties" when usingSimpleBeanPropertyFilter
. -
removeFilter
-
findFilter
Deprecated.Description copied from class:FilterProvider
Lookup method used to findBeanPropertyFilter
that has specified id. Note that id is typically aString
, but is not necessarily limited to that; that is, while standard components use String, custom implementation can choose other kinds of keys.- Specified by:
findFilter
in classFilterProvider
- Returns:
- Filter registered with specified id, if one defined; null if none found.
-
findPropertyFilter
Description copied from class:FilterProvider
Lookup method used to findPropertyFilter
that has specified id. Note that id is typically aString
, 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 asPropertyFilter
. It should be overridden by up-to-date implementations- Overrides:
findPropertyFilter
in classFilterProvider
- Parameters:
filterId
- Id of the filter to fetchvalueToFilter
- Object being filtered (usually POJO, but may be aMap
, or in future a container), if available; not available when generating schemas.- Returns:
- Filter to use, if any.
-