Package org.mvel2
Class MVELRuntime
- java.lang.Object
-
- org.mvel2.MVELRuntime
-
public class MVELRuntime extends java.lang.Object
This class contains the runtime for running compiled MVEL expressions.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.ThreadLocal<DebuggerContext>
debuggerContext
-
Constructor Summary
Constructors Constructor Description MVELRuntime()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clearAllBreakpoints()
Reset all the currently registered breakpoints.private static void
ensureDebuggerContext()
Ensures that debugger context exists.static java.lang.Object
execute(boolean debugger, CompiledExpression expression, java.lang.Object ctx, VariableResolverFactory variableFactory)
Main interpreter.static boolean
hasBreakpoints()
Tests whether or not breakpoints have been declared.static boolean
hasDebuggerContext()
Tests whether or not a debugger context exist.static void
registerBreakpoint(java.lang.String source, int line)
Register a debugger breakpoint.static void
removeBreakpoint(java.lang.String source, int line)
Remove a specific breakpoint.static void
resetDebugger()
Reset all information registered in the debugger, including the actual attached Debugger and registered breakpoints.static void
setThreadDebugger(Debugger debugger)
Sets the Debugger instance to handle breakpoints.
-
-
-
Field Detail
-
debuggerContext
private static java.lang.ThreadLocal<DebuggerContext> debuggerContext
-
-
Method Detail
-
execute
public static java.lang.Object execute(boolean debugger, CompiledExpression expression, java.lang.Object ctx, VariableResolverFactory variableFactory)
Main interpreter.- Parameters:
debugger
- Run in debug modeexpression
- The compiled expression objectctx
- The root context objectvariableFactory
- The variable factory to be injected- Returns:
- The resultant value
- See Also:
MVEL
-
registerBreakpoint
public static void registerBreakpoint(java.lang.String source, int line)
Register a debugger breakpoint.- Parameters:
source
- - the source file the breakpoint is registered inline
- - the line number of the breakpoint
-
removeBreakpoint
public static void removeBreakpoint(java.lang.String source, int line)
Remove a specific breakpoint.- Parameters:
source
- - the source file the breakpoint is registered inline
- - the line number of the breakpoint to be removed
-
hasDebuggerContext
public static boolean hasDebuggerContext()
Tests whether or not a debugger context exist.- Returns:
- boolean
-
ensureDebuggerContext
private static void ensureDebuggerContext()
Ensures that debugger context exists.
-
clearAllBreakpoints
public static void clearAllBreakpoints()
Reset all the currently registered breakpoints.
-
hasBreakpoints
public static boolean hasBreakpoints()
Tests whether or not breakpoints have been declared.- Returns:
- boolean
-
setThreadDebugger
public static void setThreadDebugger(Debugger debugger)
Sets the Debugger instance to handle breakpoints. A debugger may only be registered once per thread. Calling this method more than once will result in the second and subsequent calls to simply fail silently. To re-register the Debugger, you must callresetDebugger()
- Parameters:
debugger
- - debugger instance
-
resetDebugger
public static void resetDebugger()
Reset all information registered in the debugger, including the actual attached Debugger and registered breakpoints.
-
-