public final class UelUtil extends Object
Modifier and Type | Method and Description |
---|---|
static Object |
autoVivifyListOrMap(Object property)
Evaluates a property
Object and returns a new
List or Map . |
static Object |
evaluate(Map<String,? extends Object> context,
String expression)
Evaluates a Unified Expression Language expression and returns the result.
|
static Object |
evaluate(Map<String,? extends Object> context,
String expression,
Class<?> expectedType)
Evaluates a Unified Expression Language expression and returns the result.
|
static String |
getLocalizedMapLocaleKey() |
static String |
prepareExpression(String expression)
Prepares an expression for evaluation by UEL.
|
static void |
removeValue(Map<String,Object> context,
String expression)
Evaluates a Unified Expression Language expression and sets the resulting object
to null.
|
static Object |
resolveVariable(String variable,
Map<String,? extends Object> variables,
Locale locale) |
static void |
setValue(Map<String,Object> context,
String expression,
Class<?> expectedType,
Object value)
Evaluates a Unified Expression Language expression and sets the resulting object
to the specified value.
|
public static String getLocalizedMapLocaleKey()
public static Object evaluate(Map<String,? extends Object> context, String expression)
context
- Evaluation context (variables)expression
- UEL expressionpublic static Object evaluate(Map<String,? extends Object> context, String expression, Class<?> expectedType)
context
- Evaluation context (variables)expression
- UEL expressionexpectedType
- The expected object Class to returnpublic static void setValue(Map<String,Object> context, String expression, Class<?> expectedType, Object value)
context
- Evaluation context (variables)expression
- UEL expressionexpectedType
- The expected object Class to setpublic static void removeValue(Map<String,Object> context, String expression)
context
- Evaluation context (variables)expression
- UEL expressionpublic static Object autoVivifyListOrMap(Object property)
Object
and returns a new
List
or Map
. If property
is not a String object type and it evaluates to an integer value,
a new List
instance is returned, otherwise a new
Map
instance is returned.property
- Property Object
to be evaluatedList
or Map
public static String prepareExpression(String expression)
The OFBiz syntax is converted to UEL-compatible syntax and the resulting expression is returned.
expression
- Expression to be converted