Class SimpleFilterProvider
java.lang.Object
org.codehaus.jackson.map.ser.FilterProvider
org.codehaus.jackson.map.ser.impl.SimpleFilterProvider
Simple
FilterProvider
implementation that just stores
direct id-to-filter mapping.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Flag that indicates whether request for an unknown filter id should result an exception (default) or not.protected BeanPropertyFilter
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, BeanPropertyFilter> Mappings from ids to filters. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddFilter
(String id, BeanPropertyFilter filter) findFilter
(Object filterId) Lookup method used to findBeanPropertyFilter
that has specified id.removeFilter
(String id) Method for defining filter to return for "unknown" filters; cases where there is no mapping from given id to an explicit filter.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 is 'null' (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.- Since:
- 1.9
-
-
Constructor Details
-
SimpleFilterProvider
public SimpleFilterProvider() -
SimpleFilterProvider
- Parameters:
mapping
- Mapping from id to filter; used as is, no copy is made.
-
-
Method Details
-
setDefaultFilter
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
-
getDefaultFilter
- Since:
- 1.9
-
setFailOnUnknownId
- Since:
- 1.9
-
willFailOnUnknownId
public boolean willFailOnUnknownId()- Since:
- 1.9
-
addFilter
-
removeFilter
-
findFilter
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.
-