Class ExpressionUtil
java.lang.Object
org.eclipse.equinox.p2.metadata.expression.ExpressionUtil
Global access to factory, parser, and methods for introspection
- Since:
- 2.0
- Restriction:
- This class is not intended to be subclassed by clients.
- Restriction:
- This class is not intended to be instantiated by clients.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic IExpressionFactoryReturns the global expression factorystatic IExpressiongetLHS(IExpression expression) Obtains the Left Hand Side (LHS) of a binary expression.static StringgetName(IExpression expression) Obtains the name of a variable or member expression.static IExpressiongetOperand(IExpression expression) Obtains the operand of an unary expressionstatic IExpression[]getOperands(IExpression expression) Obtains the operands of an n-ary expressionstatic IExpressionParserCreates and returns a new expression parserstatic IExpressiongetRHS(IExpression expression) Obtains the Right Hand Side (RHS) of a binary expression.static ObjectgetValue(IExpression expression) Obtains the value of a literal expressionstatic IExpressionCreate a new expression.static IFilterExpressionParse an LDAP filter from thefilterstring.static IExpressionparseQuery(String expression) Create an arbitrary expression.static StringtrimmedOrNull(String str) Ifstrisnull, then this method returnsnull.
-
Field Details
-
TRUE_EXPRESSION
-
FALSE_EXPRESSION
-
-
Method Details
-
getFactory
Returns the global expression factory- Returns:
- The global expression factory.
-
getParser
Creates and returns a new expression parser- Returns:
- The new parser
-
parseLDAP
Parse an LDAP filter from thefilterstring. Iffilterisnullor a string that is empty or only consists of whitespace, then this method returnsnull.- Parameters:
filter- The filter to parse. Can benullor empty.- Returns:
- An expression that corresponds to the LDAP filter or
null. - Throws:
ExpressionParseException- If the syntax was invalidIllegalArgumentException
-
parse
Create a new expression. The expression will have access to the global variable 'this' and to the context parameters.- Parameters:
expression- The string representing the boolean expression.- Returns:
- The resulting expression tree.
- Throws:
ExpressionParseException- If the syntax was invalid
-
parseQuery
Create an arbitrary expression. The expression will have access to the global variable 'everything' and to the context parameters.- Parameters:
expression- The string representing the boolean expression.- Returns:
- The resulting expression tree.
- Throws:
ExpressionParseException- If the syntax was invalid
-
trimmedOrNull
Ifstrisnull, then this method returnsnull. Otherwisestris trimmed from whitespace at both ends. If the result of the trim is an empty string, thennullis returned, otherwise the result of the trim is returned.- Parameters:
str- The string to trim. Can benull.- Returns:
- The trimmed string or
null.
-
getLHS
Obtains the Left Hand Side (LHS) of a binary expression.- Parameters:
expression- The expression to introspect- Returns:
- The left hand side operator
- Throws:
IllegalArgumentException- if the expression is not a binary expression- See Also:
-
getName
Obtains the name of a variable or member expression.- Parameters:
expression- The expression to introspect- Returns:
- The name of the expression
- Throws:
IllegalArgumentException- if the expression is not a variable or a member- See Also:
-
getOperand
Obtains the operand of an unary expression- Parameters:
expression- The expression to introspect- Returns:
- The expression operand
- Throws:
IllegalArgumentException- if the expression is not an unary expression- See Also:
-
getOperands
Obtains the operands of an n-ary expression- Parameters:
expression- The expression to introspect- Returns:
- The expression operand
- Throws:
IllegalArgumentException- if the expression is not a n-ary expression- See Also:
-
getRHS
Obtains the Right Hand Side (RHS) of a binary expression.- Parameters:
expression- The expression to introspect- Returns:
- The right hand side operator
- Throws:
IllegalArgumentException- if the expression is not a binary expression- See Also:
-
getValue
Obtains the value of a literal expression- Parameters:
expression- The expression to introspect- Returns:
- The literal value
- Throws:
IllegalArgumentException- if the expression is not a literal- See Also:
-