org.apache.tamaya.filter

## Class ConfigurationFilter

- java.lang.Object
- - org.apache.tamaya.filter.ConfigurationFilter

- All Implemented Interfaces:
    org.apache.tamaya.spi.PropertyFilter

      public final class ConfigurationFilter
      extends Object
      implements org.apache.tamaya.spi.PropertyFilter

  Hereby
  - Single filters are applied only when values are explicitly accessed. This is useful, e.g. for filtering passwords into clear text variants. Nevertheless metadata keys hidden on map level must be accessible (=not filtered) when accessed as single values.
  - Map filters are applied when values are filtered as part of a full properties access. Often filtering in these cases is more commonly applied, e.g. you dont want to show up all kind of metadata.
  For both variants individual filter rules can be applied here. All filters configured are managed on a thread-local level, so this class is typically used to temporarely filter out some values. Do not forget to restore its state, when not using a thread anymore (especially important in multi-threaded environments), not doing so will create nasty side effects of configuration not being visisble depending on the thread active.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConfigurationFilter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `clearFilters()` Removes all programmable filters active on the current thread.
    `String` | `filterProperty(String valueToBeFiltered, org.apache.tamaya.spi.FilterContext context)`
    `static ProgrammableFilter` | `getMapFilters()` Access the filtering configuration that is used for filtering configuration properties accessed as full map.
    `static ProgrammableFilter` | `getSingleFilters()` Access the filtering configuration that is used for filtering single property values accessed.
    `static boolean` | `isMetadataFiltered()` Flag if metadata entries (starting with an '_') are filtered out on when accessing multiple properties, default is `true`.
    `static void` | `setMetadataFiltered(boolean filtered)` Seactivates metadata filtering also on global map access for this thread.

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

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

- - ### Constructor Detail

    - #### ConfigurationFilter

          public ConfigurationFilter()

  - ### Method Detail

    - #### isMetadataFiltered

          public static boolean isMetadataFiltered()

      Flag if metadata entries (starting with an '_') are filtered out on when accessing multiple properties, default is `true`.
      Returns:
        true, if metadata entries (starting with an '_') are to be filtered.

    - #### setMetadataFiltered

          public static void setMetadataFiltered(boolean filtered)

      Seactivates metadata filtering also on global map access for this thread.
      Parameters:
        `filtered` - true,to enable metadata filtering (default).
      See Also:
        `clearFilters()`

    - #### getSingleFilters

          public static ProgrammableFilter getSingleFilters()

      Access the filtering configuration that is used for filtering single property values accessed.
      Returns:
        the filtering config, never null.

    - #### getMapFilters

          public static ProgrammableFilter getMapFilters()

      Access the filtering configuration that is used for filtering configuration properties accessed as full map.
      Returns:
        the filtering config, never null.

    - #### clearFilters

          public static void clearFilters()

      Removes all programmable filters active on the current thread.

    - #### filterProperty

          public String filterProperty(String valueToBeFiltered,
                              org.apache.tamaya.spi.FilterContext context)

      Specified by:
        `filterProperty` in interface `org.apache.tamaya.spi.PropertyFilter`

Copyright © 2014–2016 Apache Software Foundation. All rights reserved.