Class UelUtil
- java.lang.Object
-
- org.apache.ofbiz.base.util.string.UelUtil
-
public final class UelUtil extends java.lang.Object
Implements the Unified Expression Language (JSR-245).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Object
autoVivifyListOrMap(java.lang.Object property)
Evaluates a propertyObject
and returns a newList
orMap
.static java.lang.Object
evaluate(java.util.Map<java.lang.String,? extends java.lang.Object> context, java.lang.String expression)
Evaluates a Unified Expression Language expression and returns the result.static java.lang.Object
evaluate(java.util.Map<java.lang.String,? extends java.lang.Object> context, java.lang.String expression, java.lang.Class<?> expectedType)
Evaluates a Unified Expression Language expression and returns the result.static java.lang.String
getLocalizedMapLocaleKey()
static java.lang.String
prepareExpression(java.lang.String expression)
Prepares an expression for evaluation by UEL.static void
removeValue(java.util.Map<java.lang.String,java.lang.Object> context, java.lang.String expression)
Evaluates a Unified Expression Language expression and sets the resulting object to null.static java.lang.Object
resolveVariable(java.lang.String variable, java.util.Map<java.lang.String,? extends java.lang.Object> variables, java.util.Locale locale)
static void
setValue(java.util.Map<java.lang.String,java.lang.Object> context, java.lang.String expression, java.lang.Class<?> expectedType, java.lang.Object value)
Evaluates a Unified Expression Language expression and sets the resulting object to the specified value.
-
-
-
Method Detail
-
getLocalizedMapLocaleKey
public static java.lang.String getLocalizedMapLocaleKey()
-
evaluate
public static java.lang.Object evaluate(java.util.Map<java.lang.String,? extends java.lang.Object> context, java.lang.String expression)
Evaluates a Unified Expression Language expression and returns the result.- Parameters:
context
- Evaluation context (variables)expression
- UEL expression- Returns:
- Result object
-
evaluate
public static java.lang.Object evaluate(java.util.Map<java.lang.String,? extends java.lang.Object> context, java.lang.String expression, java.lang.Class<?> expectedType)
Evaluates a Unified Expression Language expression and returns the result.- Parameters:
context
- Evaluation context (variables)expression
- UEL expressionexpectedType
- The expected object Class to return- Returns:
- Result object
-
setValue
public static void setValue(java.util.Map<java.lang.String,java.lang.Object> context, java.lang.String expression, java.lang.Class<?> expectedType, java.lang.Object value)
Evaluates a Unified Expression Language expression and sets the resulting object to the specified value.- Parameters:
context
- Evaluation context (variables)expression
- UEL expressionexpectedType
- The expected object Class to set
-
removeValue
public static void removeValue(java.util.Map<java.lang.String,java.lang.Object> context, java.lang.String expression)
Evaluates a Unified Expression Language expression and sets the resulting object to null.- Parameters:
context
- Evaluation context (variables)expression
- UEL expression
-
autoVivifyListOrMap
public static java.lang.Object autoVivifyListOrMap(java.lang.Object property)
Evaluates a propertyObject
and returns a newList
orMap
. Ifproperty
is not a String object type and it evaluates to an integer value, a newList
instance is returned, otherwise a newMap
instance is returned.- Parameters:
property
- PropertyObject
to be evaluated- Returns:
- New
List
orMap
-
prepareExpression
public static java.lang.String prepareExpression(java.lang.String expression)
Prepares an expression for evaluation by UEL.The OFBiz syntax is converted to UEL-compatible syntax and the resulting expression is returned.
- Parameters:
expression
- Expression to be converted- Returns:
- Converted expression
- See Also:
- StringUtil.convertOperatorSubstitutions(java.lang.String)
-
resolveVariable
public static java.lang.Object resolveVariable(java.lang.String variable, java.util.Map<java.lang.String,? extends java.lang.Object> variables, java.util.Locale locale)
-
-