org.apache.tamaya.resolver.internal

## Class DefaultExpressionEvaluator

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

- All Implemented Interfaces:
    ExpressionEvaluator

      @Priority(value=10000)
      public class DefaultExpressionEvaluator
      extends Object
      implements ExpressionEvaluator

  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
    `DefaultExpressionEvaluator()` Default constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `evaluateExpression(String key, String value)` Resolves an expression in the form current `${resolverId:expression}` or `${expression}`.

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

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

- - ### Constructor Detail

    - #### DefaultExpressionEvaluator

          public DefaultExpressionEvaluator()

      Default constructor.

  - ### Method Detail

    - #### evaluateExpression

          public String evaluateExpression(String key,
                                           String value)

      Resolves an expression in the form current `${resolverId:expression}` or `${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:
        `evaluateExpression` in interface `ExpressionEvaluator`
      Parameters:
        `key` - the key to be filtered
        `value` - value to be analyzed for expressions
      Returns:
        the resolved value, or the input in case where no expression was detected.

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