org.apache.tamaya.resolver.internal

## Class ExpressionResolutionFilter

- java.lang.Object
- - org.apache.tamaya.resolver.internal.ExpressionResolutionFilter

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

      @Priority(value=10000)
      public class ExpressionResolutionFilter
      extends Object
      implements org.apache.tamaya.spi.PropertyFilter

  Default expression evaluator that manages several instances of `ExpressionResolver`. Each resolver is identified by a resolver id. Each expression passed has the form resolverId:resolverExpression, which has the advantage that different resolvers can be active in parallel.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExpressionResolutionFilter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `filterProperty(String valueToBeFiltered, org.apache.tamaya.spi.FilterContext context)` Resolves an expression in the form current `${resolverId:expression}` or `${<prefix>expression}`.

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

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

- - ### Constructor Detail

    - #### ExpressionResolutionFilter

          public ExpressionResolutionFilter()

  - ### Method Detail

    - #### filterProperty

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

      Resolves an expression in the form current `${resolverId:expression}` or `${<prefix>expression}`. The expression can be part current any type current literal text. Also multiple expressions with mixed matching resolvers are supported. All control characters (${}\) can be escaped using '\'.
      So all the following are valid expressions:
      - `${expression}`
      - `bla bla ${expression}`
      - `${expression} bla bla`
      - `bla bla ${expression} bla bla`
      - `${expression}${resolverId2:expression2}`
      - `foo ${expression}${resolverId2:expression2}`
      - `foo ${expression} bar ${resolverId2:expression2}`
      - `${expression}foo${resolverId2:expression2}bar`
      - `foor${expression}bar${resolverId2:expression2}more`
      - `\${expression}foo${resolverId2:expression2}bar` (first expression is escaped).
      Given `resolverId:` is a valid prefix targeting a `Expression` explicitly, also the following expressions are valid:
      - `${resolverId:expression}`
      - `bla bla ${resolverId:expression}`
      - `${resolverId:expression} bla bla`
      - `bla bla ${resolverId:expression} bla bla`
      - `${resolverId:expression}${resolverId2:expression2}`
      - `foo ${resolverId:expression}${resolverId2:expression2}`
      - `foo ${resolverId:expression} bar ${resolverId2:expression2}`
      - `${resolverId:expression}foo${resolverId2:expression2}bar`
      - `foor${resolverId:expression}bar${resolverId2:expression2}more`
      - `\${resolverId:expression}foo${resolverId2:expression2}bar` (first expression is escaped).
      Specified by:
        `filterProperty` in interface `org.apache.tamaya.spi.PropertyFilter`
      Parameters:
        `context` - the filter context
        `valueToBeFiltered` - value to be analyzed for expressions
      Returns:
        the resolved value, or the input in case where no expression was detected.

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