Package org.mvel2
Class SandboxedParserContext
- java.lang.Object
-
- org.mvel2.ParserContext
-
- org.mvel2.SandboxedParserContext
-
- All Implemented Interfaces:
Serializable
public class SandboxedParserContext extends ParserContext
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.mvel2.ParserContext
inputs, variables, variablesEscape
-
-
Constructor Summary
Constructors Constructor Description SandboxedParserContext(SandboxedParserConfiguration sandboxedParserConfiguration)SandboxedParserContext(SandboxedParserConfiguration sandboxedParserConfiguration, ParserContext parent, boolean functionContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddImport(Class cls)Adds an import for the specified Class.voidaddImport(String name, Class cls)Adds an import for a specified Class using an alias.voidaddImport(String name, Method method)Adds an import for a specified Method representing a static method import using an alias.voidaddImport(String name, MethodStub method)Adds a static import for the specifiedMethodStubwith an alias.voidaddImport(Proto proto)ParserContextcreateFunctionContext(ParserConfiguration parserConfiguration)protected ParserContextcreateNewParserContext(ParserConfiguration parserConfiguration)ObjectgetLiteral(String property)booleanhasLiteral(String property)booleanisMethodAllowed(Method method)protected ParserContextprepareColoringSubcontext(ParserConfiguration parserConfiguration, ParserContext _parent)voidsetLiterals(Map<String,Object> literals)-
Methods inherited from class org.mvel2.ParserContext
addError, addIndexedInput, addIndexedInput, addIndexedInputs, addIndexedLocals, addIndexedLocals, addInput, addInput, addInputs, addLocalDeclaration, addPackageImport, addTypeParameters, addVariable, addVariable, addVariables, create, createColoringSubcontext, createSubcontext, declareFunction, getClassLoader, getCompiledExpressionCache, getErrorList, getEvaluationContext, getFunction, getFunctions, getImport, getImports, getIndexedInputs, getIndexedVarNames, getInputs, getInterceptors, getLastLineLabel, getLastTypeParameters, getLineCount, getLineFor, getLineOffset, getParserConfiguration, getProtoImport, getReturnTypeCache, getRootParser, getSourceFile, getStaticImport, getStaticOrClassImport, getTypeParameters, getTypeParametersAsArray, getVariables, getVariableScope, getVarOrInputType, getVarOrInputTypeOrNull, hasFunction, hasFunction, hasImport, hasImports, hasIndexedInputs, hasLocalDeclaration, hasProtoImport, hasVarOrInput, incrementLineCount, initializeTables, initLineMapping, isAllowBootstrapBypass, isBlockSymbols, isCompiled, isDebugSymbols, isExecutableCodeReached, isFatalError, isFunctionContext, isIndexAllocation, isLineMapped, isOptimizerNotified, isRetainParserState, isStrictTypeEnforcement, isStrongTyping, isVariablesEscape, isVariableVisible, isVisitedLine, makeVisible, optimizationNotify, popVariableScope, processTables, pushVariableScope, setAllowBootstrapBypass, setBlockSymbols, setCompiled, setDebugSymbols, setErrorList, setExecutableCodeReached, setFatalError, setImports, setIndexAllocation, setInputs, setInterceptors, setLastLineLabel, setLastTypeParameters, setLineAndOffset, setLineCount, setLineOffset, setRetainParserState, setRootParser, setSourceFile, setStrictTypeEnforcement, setStrongTyping, setVariables, stronglyTyped, variableIndexOf, visitLine, withImport, withIndexedVars, withInput, withInputs, withTypeParameters
-
-
-
-
Constructor Detail
-
SandboxedParserContext
public SandboxedParserContext(SandboxedParserConfiguration sandboxedParserConfiguration)
-
SandboxedParserContext
public SandboxedParserContext(SandboxedParserConfiguration sandboxedParserConfiguration, ParserContext parent, boolean functionContext)
-
-
Method Detail
-
createFunctionContext
public ParserContext createFunctionContext(ParserConfiguration parserConfiguration)
- Overrides:
createFunctionContextin classParserContext
-
createNewParserContext
protected ParserContext createNewParserContext(ParserConfiguration parserConfiguration)
- Overrides:
createNewParserContextin classParserContext
-
prepareColoringSubcontext
protected ParserContext prepareColoringSubcontext(ParserConfiguration parserConfiguration, ParserContext _parent)
- Overrides:
prepareColoringSubcontextin classParserContext
-
hasLiteral
public boolean hasLiteral(String property)
- Overrides:
hasLiteralin classParserContext
-
getLiteral
public Object getLiteral(String property)
- Overrides:
getLiteralin classParserContext
-
setLiterals
public void setLiterals(Map<String,Object> literals)
- Overrides:
setLiteralsin classParserContext
-
isMethodAllowed
public boolean isMethodAllowed(Method method)
- Overrides:
isMethodAllowedin classParserContext
-
addImport
public void addImport(Class cls)
Description copied from class:ParserContextAdds an import for the specified Class.- Overrides:
addImportin classParserContext- Parameters:
cls- The instance of the Class which represents the imported class.
-
addImport
public void addImport(Proto proto)
- Overrides:
addImportin classParserContext
-
addImport
public void addImport(String name, Class cls)
Description copied from class:ParserContextAdds an import for a specified Class using an alias. For example:
... doing this would allow an MVEL script to be written as such:parserContext.addImport("sys", System.class);sys.currentTimeMillis();- Overrides:
addImportin classParserContext- Parameters:
name- The alias to usecls- The instance of the Class which represents the imported class.
-
addImport
public void addImport(String name, Method method)
Description copied from class:ParserContextAdds an import for a specified Method representing a static method import using an alias. For example:
... doing this allows the System.currentTimeMillis() method to be executed in a script simply by writing time().parserContext.addImport("time", MVEL.getStaticMethod(System.class, "currentTimeMillis", new Class[0]));- Overrides:
addImportin classParserContext- Parameters:
name- The alias to usemethod- The instance of Method which represents the static import.
-
addImport
public void addImport(String name, MethodStub method)
Description copied from class:ParserContextAdds a static import for the specifiedMethodStubwith an alias.- Overrides:
addImportin classParserContext- Parameters:
name- The alias to usemethod- The instance of Method which represents the static import.- See Also:
ParserContext.addImport(String, org.mvel2.util.MethodStub)
-
-