T
- expected result typepublic class Expression<T> extends Object
Modifier and Type | Field and Description |
---|---|
protected javax.el.ValueExpression |
valueExpression
The underlying EL expression that this object represents.
|
Modifier | Constructor and Description |
---|---|
protected |
Expression(String expression,
Class<T> expectedType,
Bindings initialBindings)
Constructs an expression for later evaluation.
|
Modifier and Type | Method and Description |
---|---|
T |
eval()
Convenient method to eval an Expression that does not need a scope.
|
T |
eval(Bindings bindings)
Evaluates the expression within the specified bindings and returns the resulting object if it matches the
specified type, or
null if it does not resolve or match. |
String |
toString()
Returns the original string used to create this expression, unmodified.
|
static <T> Expression<T> |
valueOf(String expression,
Class<T> expectedType)
Factory method to create an Expression.
|
static <T> Expression<T> |
valueOf(String expression,
Class<T> expectedType,
Bindings initialBindings)
Factory method to create an Expression.
|
protected final javax.el.ValueExpression valueExpression
protected Expression(String expression, Class<T> expectedType, Bindings initialBindings) throws ExpressionException
expression
- the expression to parse.expectedType
- The expected result type of the expression.initialBindings
- The initial bindings used when evaluated this expressionExpressionException
- if the expression was not syntactically correct.public static <T> Expression<T> valueOf(String expression, Class<T> expectedType) throws ExpressionException
T
- expected result typeexpression
- The expression to parse.expectedType
- The expected result type of the expression.ExpressionException
- if the expression was not syntactically correct.public static <T> Expression<T> valueOf(String expression, Class<T> expectedType, Bindings initialBindings) throws ExpressionException
T
- expected result typeexpression
- The expression to parse.expectedType
- The expected result type of the expression.initialBindings
- The initial bindings used when evaluated this expressionExpressionException
- if the expression was not syntactically correct.public T eval(Bindings bindings)
null
if it does not resolve or match.bindings
- the bindings to evaluate the expression within.null
if it does not resolve or match the type.public T eval()
null
if it does not resolve or match the type.public String toString()
Note to implementors: That returned value must be usable in Expression.valueOf() to create an equivalent Expression(somehow cloning this instance)
Copyright 2011-2017 ForgeRock AS.