|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.unkrig.commons.text.expression.ExpressionUtil
public final class ExpressionUtil
Utility class for Expression.
| Method Summary | ||
|---|---|---|
static Expression |
constantExpression(java.lang.Object value)
|
|
static java.lang.String |
evaluateLeniently(Expression expression,
Mapping<java.lang.String,?> variables)
|
|
static
|
evaluateTo(Expression expression,
Mapping<java.lang.String,?> variables,
java.lang.Class<T> targetClass)
|
|
static Expression |
expand(java.lang.String s,
Predicate<java.lang.String> isValidVariableName)
Turns the given string into an expression. |
|
static Expression |
expand(java.lang.String s,
java.util.Set<java.lang.String> variableNames)
Turns the given string into an expression. |
|
static Expression |
fromPredicate(Predicate<java.lang.String> predicate,
java.lang.String variableName)
|
|
static Expression |
logicalAnd(Expression operand1,
Expression operand2)
|
|
static Expression |
logicalOr(Expression operand1,
Expression operand2)
|
|
static
|
toPredicate(Expression expression,
java.lang.String parameterName)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Expression constantExpression(@Nullable
java.lang.Object value)
Expression that evaluates to a constant value.
public static Expression expand(java.lang.String s,
java.util.Set<java.lang.String> variableNames)
throws ParseException
s - The string to expandvariableNames - All contained variable names can be used in the expression
ParseException
public static Expression expand(java.lang.String s,
Predicate<java.lang.String> isValidVariableName)
throws ParseException
s - The string to expandisValidVariableName - Evalutaes to whether the subject is a valid variable name
ParseException
public static java.lang.String evaluateLeniently(Expression expression,
Mapping<java.lang.String,?> variables)
@Nullable
public static <T> T evaluateTo(Expression expression,
Mapping<java.lang.String,?> variables,
java.lang.Class<T> targetClass)
throws EvaluationException
EvaluationException - The expression evaluates to null
EvaluationException - A problem occurred during evaluation, e.g. a class could not be loaded, or a type
cast could not be performed
public static <T> Predicate<T> toPredicate(Expression expression,
java.lang.String parameterName)
parameterName - The name under which the predicate subject is accessible for the expression
Predicate which evaluates to the value of the given expression
public static Expression fromPredicate(Predicate<java.lang.String> predicate,
java.lang.String variableName)
Expression which evaluates to the result of the given predicate, where the subject
to the predicate is the value of the named variable of the expression
public static Expression logicalAnd(Expression operand1,
Expression operand2)
Expression which evaluates the operand1, and, if that is true the
operand2
public static Expression logicalOr(Expression operand1,
Expression operand2)
Expression which evaluates the operand1, and, if that is false the
operand2
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||