com.isomorphic.datasource

## Class DataSourceBeanFilter

- java.lang.Object
- - com.isomorphic.datasource.DataSourceBeanFilter

-     public class DataSourceBeanFilter
      extends java.lang.Object

  An IBeanFilter that applies DataSource.getProperties() to all bean values (e.g. applying valueXPath) and optionally strips any bean properties that do not have a corresponding DataSource field definition.

  Note: this filter is automatically applied by the RPCManager to all DSResponse objects sent to the client in order to perform valueXPath resolution.

  See Also:
    `IBeanFilter`, `DataSource.getProperties(java.lang.Object)`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DataSourceBeanFilter(DataSource dataSource, boolean dropExtraFields)` Creates a new DataSourceBeanFilter
    `DataSourceBeanFilter(DataSource dataSource, boolean dropExtraFields, boolean dropIgnoredFields)` Creates a new DataSourceBeanFilter
    `DataSourceBeanFilter(DataSource dataSource, java.util.Collection propsToKeep)` Creates a new DataSourceBeanFilter
    `DataSourceBeanFilter(java.lang.String dataSource, boolean dropExtraFields)` Creates a new DataSourceBeanFilter
    `DataSourceBeanFilter(java.lang.String dataSource, boolean dropExtraFields, boolean dropIgnoredFields)` Creates a new DataSourceBeanFilter
    `DataSourceBeanFilter(java.lang.String dataSource, java.util.Collection propsToKeep)` Creates a new DataSourceBeanFilter

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Map` | `filter(java.lang.Object obj)` This method is called to filter a bean (IBeanFilter Interface).

- - ### Constructor Detail

    - #### DataSourceBeanFilter

          public DataSourceBeanFilter(java.lang.String dataSource,
                                      boolean dropExtraFields)

      Creates a new DataSourceBeanFilter
      Parameters:
        `dataSource` - DataSource to use, as a String.
        `dropExtraFields` - If true, this filter will drop all bean properties that do not have a corresponding DataSource field definition. If false, those extra fields will not be removed by the filter.

    - #### DataSourceBeanFilter

          public DataSourceBeanFilter(DataSource dataSource,
                                      boolean dropExtraFields)

      Creates a new DataSourceBeanFilter
      Parameters:
        `dataSource` - DataSource to use, as a DataSource instance.
        `dropExtraFields` - If true, this filter will drop all bean properties that do not have a corresponding DataSource field definition. If false, those extra fields will not be removed by the filter.

    - #### DataSourceBeanFilter

          public DataSourceBeanFilter(java.lang.String dataSource,
                                      boolean dropExtraFields,
                                      boolean dropIgnoredFields)

      Creates a new DataSourceBeanFilter
      Parameters:
        `dataSource` - DataSource to use, as a String.
        `dropExtraFields` - If true, this filter will drop all bean properties that do not have a corresponding DataSource field definition. If false, those extra fields will not be removed by the filter.
        `dropIgnoredFields` - If true, this filter will drop all bean properties where the corresponding DataSource field definition is marked with the property ignore: true. If false, the ignored fields will not be removed by the filter.

    - #### DataSourceBeanFilter

          public DataSourceBeanFilter(DataSource dataSource,
                                      boolean dropExtraFields,
                                      boolean dropIgnoredFields)

      Creates a new DataSourceBeanFilter
      Parameters:
        `dataSource` - DataSource to use, as a DataSource instance.
        `dropExtraFields` - If true, this filter will drop all bean properties that do not have a corresponding DataSource field definition. If false, those extra fields will not be removed by the filter.
        `dropIgnoredFields` - If true, this filter will drop all bean properties where the corresponding DataSource field definition is marked with the property ignore: true. If false, the ignored fields will not be removed by the filter.

    - #### DataSourceBeanFilter

          public DataSourceBeanFilter(java.lang.String dataSource,
                                      java.util.Collection propsToKeep)

      Creates a new DataSourceBeanFilter
      Parameters:
        `dataSource` - DataSource to use, as a String.
        `propsToKeep` - Explicit list of properties to keep.

    - #### DataSourceBeanFilter

          public DataSourceBeanFilter(DataSource dataSource,
                                      java.util.Collection propsToKeep)

      Creates a new DataSourceBeanFilter
      Parameters:
        `dataSource` - DataSource to use, as a DataSource instance.
        `propsToKeep` - Explicit list of properties to keep.

  - ### Method Detail

    - #### filter

          public java.util.Map filter(java.lang.Object obj)
                               throws java.lang.Exception

      This method is called to filter a bean (IBeanFilter Interface). Returns the bean as filtered by this filter.
      Parameters:
        `obj` - the bean to convert
      Returns:
        the converted bean as a Map
      Throws:
        `java.lang.Exception`