public final class ExpressionUtil extends 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 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 Object |
getValue(IExpression expression)
Obtains the value of a literal expression
|
static IExpression |
parse(String expression)
Create a new expression.
|
static IFilterExpression |
parseLDAP(String filter)
Parse an LDAP filter from the
filter string. |
static IExpression |
parseQuery(String expression)
Create an arbitrary expression.
|
static String |
trimmedOrNull(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(String filter) throws 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 invalidIllegalArgumentException
public static IExpression parse(String expression)
expression
- The string representing the boolean expression.ExpressionParseException
- If the syntax was invalidpublic static IExpression parseQuery(String expression)
expression
- The string representing the boolean expression.ExpressionParseException
- If the syntax was invalidpublic static String trimmedOrNull(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 introspectIllegalArgumentException
- 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_EQUALS
public static String getName(IExpression expression)
expression
- The expression to introspectIllegalArgumentException
- if the expression is not a variable or a memberIExpression.TYPE_MEMBER
,
IExpression.TYPE_VARIABLE
public static IExpression getOperand(IExpression expression)
expression
- The expression to introspectIllegalArgumentException
- if the expression is not an unary expressionIExpression.TYPE_ALL
,
IExpression.TYPE_EXISTS
,
IExpression.TYPE_LAMBDA
,
IExpression.TYPE_NOT
public static IExpression[] getOperands(IExpression expression)
expression
- The expression to introspectIllegalArgumentException
- if the expression is not a n-ary expressionIExpression.TYPE_AND
,
IExpression.TYPE_OR
public static IExpression getRHS(IExpression expression)
expression
- The expression to introspectIllegalArgumentException
- 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_EQUALS
public static Object getValue(IExpression expression)
expression
- The expression to introspectIllegalArgumentException
- if the expression is not a literalIExpression.TYPE_LITERAL
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.