public final class ExpressionUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static IExpression |
FALSE_EXPRESSION |
static IExpression |
TRUE_EXPRESSION |
| Modifier and Type | Method and Description |
|---|---|
static IExpressionFactory |
getFactory()
Returns the global expression factory
|
static IExpression |
getLHS(IExpression expression)
Obtains the Left Hand Side (LHS) of a binary expression.
|
static java.lang.String |
getName(IExpression expression)
Obtains the name of a variable or member expression.
|
static IExpression |
getOperand(IExpression expression)
Obtains the operand of an unary expression
|
static IExpression[] |
getOperands(IExpression expression)
Obtains the operands of an n-ary expression
|
static IExpressionParser |
getParser()
Creates and returns a new expression parser
|
static IExpression |
getRHS(IExpression expression)
Obtains the Right Hand Side (RHS) of a binary expression.
|
static java.lang.Object |
getValue(IExpression expression)
Obtains the value of a literal expression
|
static IExpression |
parse(java.lang.String expression)
Create a new expression.
|
static IFilterExpression |
parseLDAP(java.lang.String filter)
Parse an LDAP filter from the
filter string. |
static IExpression |
parseQuery(java.lang.String expression)
Create an arbitrary expression.
|
static java.lang.String |
trimmedOrNull(java.lang.String str)
If
str is null, then this method returns null. |
public static final IExpression TRUE_EXPRESSION
public static final IExpression FALSE_EXPRESSION
public static IExpressionFactory getFactory()
public static IExpressionParser getParser()
public static IFilterExpression parseLDAP(java.lang.String filter) throws java.lang.IllegalArgumentException
filter string. If filter is null
or a string that is empty or only consists of whitespace, then this method returns null.filter - The filter to parse. Can be null or empty.null.ExpressionParseException - If the syntax was invalidjava.lang.IllegalArgumentExceptionpublic static IExpression parse(java.lang.String expression)
expression - The string representing the boolean expression.ExpressionParseException - If the syntax was invalidpublic static IExpression parseQuery(java.lang.String expression)
expression - The string representing the boolean expression.ExpressionParseException - If the syntax was invalidpublic static java.lang.String trimmedOrNull(java.lang.String str)
str is null, then this method returns null.
Otherwise str is trimmed from whitespace at both ends. If the result
of the trim is an empty string, then null is returned, otherwise the
result of the trim is returned.str - The string to trim. Can be null.null.public static IExpression getLHS(IExpression expression)
expression - The expression to introspectjava.lang.IllegalArgumentException - if the expression is not a binary expressionIExpression.TYPE_AT,
IExpression.TYPE_EQUALS,
IExpression.TYPE_GREATER,
IExpression.TYPE_GREATER_EQUAL,
IExpression.TYPE_LESS,
IExpression.TYPE_LESS_EQUAL,
IExpression.TYPE_MATCHES,
IExpression.TYPE_NOT_EQUALSpublic static java.lang.String getName(IExpression expression)
expression - The expression to introspectjava.lang.IllegalArgumentException - if the expression is not a variable or a memberIExpression.TYPE_MEMBER,
IExpression.TYPE_VARIABLEpublic static IExpression getOperand(IExpression expression)
expression - The expression to introspectjava.lang.IllegalArgumentException - if the expression is not an unary expressionIExpression.TYPE_ALL,
IExpression.TYPE_EXISTS,
IExpression.TYPE_LAMBDA,
IExpression.TYPE_NOTpublic static IExpression[] getOperands(IExpression expression)
expression - The expression to introspectjava.lang.IllegalArgumentException - if the expression is not a n-ary expressionIExpression.TYPE_AND,
IExpression.TYPE_ORpublic static IExpression getRHS(IExpression expression)
expression - The expression to introspectjava.lang.IllegalArgumentException - if the expression is not a binary expressionIExpression.TYPE_AT,
IExpression.TYPE_EQUALS,
IExpression.TYPE_GREATER,
IExpression.TYPE_GREATER_EQUAL,
IExpression.TYPE_LESS,
IExpression.TYPE_LESS_EQUAL,
IExpression.TYPE_MATCHES,
IExpression.TYPE_NOT_EQUALSpublic static java.lang.Object getValue(IExpression expression)
expression - The expression to introspectjava.lang.IllegalArgumentException - if the expression is not a literalIExpression.TYPE_LITERAL
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.