public class MvelHelper extends Object
org.mvel.mvel2
module is removed by default for security reasons, but one can override and
have backwards compatible support by adding the mvel module to the path.Modifier and Type | Field and Description |
---|---|
static MethodHandle |
HANDLE_COMPILE_EXPRESSION
MethodHandle for method compileExpression(String expr, ParserContext ctx) from org.mvel2.MVEL.
|
static MethodHandle |
HANDLE_COMPILE_SET_EXPRESSION
MethodHandle for method compileSetExpression(String expr, ParserContext ctx) from org.mvel2.MVEL.
|
static MethodHandle |
HANDLE_EXECUTE_EXPRESSION
MethodHandle for method executeExpression(Object compiledExpr, Object ctx) from org.mvel2.MVEL.
|
static MethodHandle |
HANDLE_EXECUTE_SET_EXPRESSION
MethodHandle for method executeSetExpression(Serializable compiledExpr, Object ctx, Object value) from org.mvel2.MVEL.
|
static MethodHandle |
HANDLE_PARSER_CONFIGURATION_SET_CLASS_LOADER
MethodHandle for method setClassLoader() from org.mvel2.ParserConfiguration.
|
static MethodHandle |
HANDLE_PARSER_CONTEXT_ADD_PACKAGE_IMPORT
MethodHandle for method addPackageImport(String) from org.mvel2.ParserContext.
|
static MethodHandle |
HANDLE_PARSER_CONTEXT_GET_PARSER_CONFIGURATION
MethodHandle for method getParserConfiguration() from org.mvel2.ParserContext.
|
static Class<?> |
s_clzMVEL
Reflection lookup of class org.mvel2.MVEL.
|
static Class<?> |
s_clzParserContext
Reflection lookup of class org.mvel2.ParserContext.
|
static boolean |
s_fEnabled
True iff mvel2 jar is on classpath and all reflection lookups succeeded.
|
Constructor and Description |
---|
MvelHelper() |
Modifier and Type | Method and Description |
---|---|
static Serializable |
compileExpression(String sExpr,
Object ctx)
Compile
sExpr within ParserContext ctx . |
static Serializable |
compileSetExpression(String sExpr,
Object ctx)
Compile
sExpr using ParserContext ctx . |
static Object |
executeExpression(Object compiledExpr,
Object oTarget)
Executes a compiledExpression against target.
|
static void |
executeSetExpression(Serializable compiledSet,
Object oTarget,
Object oValue)
Set property referenced by
compiledSet expression in oTarget to Ovalue .. |
static Object |
getMvelParserContext()
Return an instance of ParserContext to be used for MVEL compilation.
|
static boolean |
isEnabled()
Return true if optional
org.mvel.mvel2 module is loaded from path. |
public static final boolean s_fEnabled
public static final Class<?> s_clzMVEL
public static final Class<?> s_clzParserContext
public static final MethodHandle HANDLE_PARSER_CONTEXT_ADD_PACKAGE_IMPORT
public static final MethodHandle HANDLE_PARSER_CONTEXT_GET_PARSER_CONFIGURATION
public static final MethodHandle HANDLE_PARSER_CONFIGURATION_SET_CLASS_LOADER
public static final MethodHandle HANDLE_COMPILE_EXPRESSION
public static final MethodHandle HANDLE_EXECUTE_EXPRESSION
public static final MethodHandle HANDLE_COMPILE_SET_EXPRESSION
public static final MethodHandle HANDLE_EXECUTE_SET_EXPRESSION
public static boolean isEnabled()
org.mvel.mvel2
module is loaded from path.
Due to security concerns, Mvel is removed from default implementation and
only optionally available for backwards compatibility mode.public static Object getMvelParserContext()
public static Serializable compileExpression(String sExpr, Object ctx)
sExpr
within ParserContext ctx
.sExpr
- expressionctx
- ParserContextSerializable
compiled expressionpublic static Object executeExpression(Object compiledExpr, Object oTarget)
compiledExpr
- compiled expression to select data from targetoTarget
- target objectoTarget
public static Serializable compileSetExpression(String sExpr, Object ctx)
sExpr
using ParserContext ctx
.sExpr
- expressionctx
- ParserContextSerializable
compiled expressionpublic static void executeSetExpression(Serializable compiledSet, Object oTarget, Object oValue)
compiledSet
expression in oTarget
to Ovalue
..compiledSet
- result of compileSetExpression(String, Object)
oTarget
- object to be updatedoValue
- value to update the computed property