SimpleFilterProvider (Jackson JSON Processor)
Date: 2013-07-14

org.codehaus.jackson.map.ser.impl

## Class SimpleFilterProvider

- java.lang.Object
- - org.codehaus.jackson.map.ser.FilterProvider
  - - org.codehaus.jackson.map.ser.impl.SimpleFilterProvider

-     public class SimpleFilterProvider
      extends FilterProvider

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

- - ### Field Summary

    Fields
    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 BeanPropertyFilter` | `_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,BeanPropertyFilter>` | `_filtersById` Mappings from ids to filters.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleFilterProvider()`
    `SimpleFilterProvider(Map<String,BeanPropertyFilter> mapping)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `SimpleFilterProvider` | `addFilter(String id, BeanPropertyFilter filter)`
    `BeanPropertyFilter` | `findFilter(Object filterId)` Lookup method used to find `BeanPropertyFilter` that has specified id.
    `BeanPropertyFilter` | `getDefaultFilter()`
    `BeanPropertyFilter` | `removeFilter(String id)`
    `SimpleFilterProvider` | `setDefaultFilter(BeanPropertyFilter f)` Method for defining filter to return for "unknown" filters; cases where there is no mapping from given id to an explicit filter.
    `SimpleFilterProvider` | `setFailOnUnknownId(boolean state)`
    `boolean` | `willFailOnUnknownId()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### _filtersById

          protected final Map<String,BeanPropertyFilter> _filtersById

      Mappings from ids to filters.

    - #### _defaultFilter

          protected BeanPropertyFilter _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 _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.
      Since:
        1.9

  - ### Constructor Detail

    - #### SimpleFilterProvider

          public SimpleFilterProvider()

    - #### SimpleFilterProvider

          public SimpleFilterProvider(Map<String,BeanPropertyFilter> mapping)

      Parameters:
        `mapping` - Mapping from id to filter; used as is, no copy is made.

  - ### Method Detail

    - #### setDefaultFilter

          public SimpleFilterProvider setDefaultFilter(BeanPropertyFilter f)

      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

          public BeanPropertyFilter getDefaultFilter()

      Since:
        1.9

    - #### setFailOnUnknownId

          public SimpleFilterProvider setFailOnUnknownId(boolean state)

      Since:
        1.9

    - #### willFailOnUnknownId

          public boolean willFailOnUnknownId()

      Since:
        1.9

    - #### addFilter

          public SimpleFilterProvider addFilter(String id,
                                       BeanPropertyFilter filter)

    - #### removeFilter

          public BeanPropertyFilter removeFilter(String id)

    - #### findFilter

          public BeanPropertyFilter findFilter(Object filterId)

      Description copied from class: `FilterProvider`
      Lookup method used to find `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.
      Specified by:
        `findFilter` in class `FilterProvider`
      Returns:
        Filter registered with specified id, if one defined; null if none found.