Package org.apache.commons.jexl3.parser
Class ASTJexlScript
- java.lang.Object
-
- org.apache.commons.jexl3.parser.SimpleNode
-
- org.apache.commons.jexl3.parser.JexlNode
-
- org.apache.commons.jexl3.parser.JexlLexicalNode
-
- org.apache.commons.jexl3.parser.ASTJexlScript
-
- All Implemented Interfaces:
JexlCache.Reference,JexlParser.LexicalUnit,Node
- Direct Known Subclasses:
ASTJexlLambda
public class ASTJexlScript extends JexlLexicalNode
Enhanced script to allow parameter declaration.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.commons.jexl3.parser.JexlNode
JexlNode.Constant<T>, JexlNode.Funcall, JexlNode.Info, JexlNode.JxltHandle
-
-
Field Summary
Fields Modifier and Type Field Description private JexlFeaturesfeaturesFeatures.private java.util.Map<java.lang.String,java.lang.Object>pragmasThe pragmas.private ScopescopeThe script scope.private static longserialVersionUIDSerial uid.-
Fields inherited from class org.apache.commons.jexl3.parser.SimpleNode
id
-
-
Constructor Summary
Constructors Constructor Description ASTJexlScript(int id)ASTJexlScript(Parser p, int id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FramecreateFrame(java.lang.Object... values)Creates an array of arguments by copying values up to the number of parameters.FramecreateFrame(Frame caller, java.lang.Object... values)Creates an array of arguments by copying values up to the number of parameters.intgetArgCount()Gets the (maximum) number of arguments this script expects.java.lang.String[]getCapturedVariables()Gets this script captured variable, i.e.JexlFeaturesgetFeatures()java.lang.String[]getLocalVariables()Gets this script local variable, i.e.java.lang.String[]getParameters()Gets this script parameters, i.e.java.util.Map<java.lang.String,java.lang.Object>getPragmas()ScopegetScope()java.lang.String[]getSymbols()Gets this script symbols, i.e.booleanisCapturedSymbol(int symbol)Checks whether a given symbol is captured.java.lang.ObjectjjtAccept(ParserVisitor visitor, java.lang.Object data)Accepts the visitor.ASTJexlScriptscript()Consider script with no parameters that return lambda as parametric-scripts.voidsetFeatures(JexlFeatures theFeatures)Sets this script features.voidsetPragmas(java.util.Map<java.lang.String,java.lang.Object> thePragmas)Sets this script pragmas.voidsetScope(Scope theScope)Sets this script scope.-
Methods inherited from class org.apache.commons.jexl3.parser.JexlLexicalNode
declareSymbol, getLexicalScope, getSymbolCount, hasSymbol, isConstant, jjtClose, setConstant
-
Methods inherited from class org.apache.commons.jexl3.parser.JexlNode
clearCache, getCache, getColumn, getLine, isConstant, isConstant, isGlobalVar, isLeftValue, isSafeLhs, isStrictOperator, jexlInfo, jexlInfo, jjtSetFirstToken, jjtSetLastToken, setCache
-
Methods inherited from class org.apache.commons.jexl3.parser.SimpleNode
childrenAccept, dump, dumpOut, getId, jjtAddChild, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtGetValue, jjtOpen, jjtSetChildren, jjtSetParent, jjtSetValue, toString, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serial uid.- See Also:
- Constant Field Values
-
pragmas
private java.util.Map<java.lang.String,java.lang.Object> pragmas
The pragmas.
-
features
private transient JexlFeatures features
Features.
-
scope
private transient Scope scope
The script scope.
-
-
Constructor Detail
-
ASTJexlScript
public ASTJexlScript(int id)
-
ASTJexlScript
public ASTJexlScript(Parser p, int id)
-
-
Method Detail
-
createFrame
public Frame createFrame(Frame caller, java.lang.Object... values)
Creates an array of arguments by copying values up to the number of parameters.- Parameters:
caller- the calling framevalues- the argument values- Returns:
- the arguments array
-
createFrame
public Frame createFrame(java.lang.Object... values)
Creates an array of arguments by copying values up to the number of parameters.- Parameters:
values- the argument values- Returns:
- the arguments array
-
getArgCount
public int getArgCount()
Gets the (maximum) number of arguments this script expects.- Returns:
- the number of parameters
-
getCapturedVariables
public java.lang.String[] getCapturedVariables()
Gets this script captured variable, i.e. symbols captured from outer scopes.- Returns:
- the captured variable names
-
getFeatures
public JexlFeatures getFeatures()
- Returns:
- this script scope
-
getLocalVariables
public java.lang.String[] getLocalVariables()
Gets this script local variable, i.e. symbols assigned to local variables.- Returns:
- the local variable names
-
getParameters
public java.lang.String[] getParameters()
Gets this script parameters, i.e. symbols assigned before creating local variables.- Returns:
- the parameter names
-
getPragmas
public java.util.Map<java.lang.String,java.lang.Object> getPragmas()
- Returns:
- this script pragmas.
-
getScope
public Scope getScope()
- Returns:
- this script scope
-
getSymbols
public java.lang.String[] getSymbols()
Gets this script symbols, i.e. parameters and local variables.- Returns:
- the symbol names
-
isCapturedSymbol
public boolean isCapturedSymbol(int symbol)
Checks whether a given symbol is captured.- Parameters:
symbol- the symbol number- Returns:
- true if captured, false otherwise
-
jjtAccept
public java.lang.Object jjtAccept(ParserVisitor visitor, java.lang.Object data)
Description copied from class:SimpleNodeAccepts the visitor.- Specified by:
jjtAcceptin interfaceNode- Overrides:
jjtAcceptin classSimpleNode- Parameters:
visitor- the visitordata- contextual data- Returns:
- result of visit
-
script
public ASTJexlScript script()
Consider script with no parameters that return lambda as parametric-scripts.- Returns:
- the script
-
setFeatures
public void setFeatures(JexlFeatures theFeatures)
Sets this script features.- Parameters:
theFeatures- the features
-
setPragmas
public void setPragmas(java.util.Map<java.lang.String,java.lang.Object> thePragmas)
Sets this script pragmas.- Parameters:
thePragmas- the pragmas
-
setScope
public void setScope(Scope theScope)
Sets this script scope.- Parameters:
theScope- the scope
-
-