| java.lang.Object org.onemind.jxp.JxpProcessor
JxpProcessor | public class JxpProcessor implements JxpParserVisitor(Code) | | The jxp processor
author: TiongHiang Lee (thlee@onemindsoft.org) |
Method Summary | |
protected Object | assign(SimpleNode node, Object value) | protected Object | assignVariable(String name, Object value) | protected Object | callFunction(String methodName, Object[] args) Call the function of the processor. | public void | declareFunctionLocals(String functionName, SimpleNode params, Object[] args) | public void | flush() | final public JxpContext | getContext() | public JxpProcessingContext | getCurrentContext() | public Map | getEnvironment() | public Counter | getMethodStats() | protected Object | includeCall(String id) | protected Object | instantiate(Class type, Object[] args) | protected Object | invokeMethod(Object obj, String methodName, Object[] args) | final protected boolean | isCheckFunctionArgumentType() | protected Object | lookupVariable(String variableName) | public static void | main(String[] args) | protected void | print(Object o) print the object by printing o.toString() using writer of current context. | protected void | print(String s) | protected void | println(Object o) | protected void | println(String s) | public Object | process(String id, Writer writer) | public Object | process(String id, Writer writer, Map env) | protected Object | process(String id, JxpProcessingContext context) | protected Object | processCall(String id) | protected Object[] | resolveArguments(AstArguments node, JxpProcessingContext context) | protected int[] | resolveArrayDims(AstArrayDims node, JxpProcessingContext context) | protected Assignable | resolveAssignmentTarget(SimpleNode node, boolean throwException) Resolve the assignment target. | final protected Class | resolveClass(String className) Resolve the class. | protected Object | resolveField(Object obj, String fieldName) Resolve the field on and object. | protected Object | resolveName(List l) Resolve a object given the name in current processing context. | final protected void | setCheckFunctionArgumentType(boolean checkFunctionArgumentType) | public void | setDoMethodStats(boolean flag) | public Object | visit(AstArguments node, Object data) | public Object | visit(AstArrayAllocationExpression node, Object data) | public Object | visit(AstArrayDims node, Object data) | public Object | visit(AstArrayInitializer node, Object data) | public Object | visit(AstArrayReference node, Object data) | public Object | visit(AstAssertStatement node, Object data) | public Object | visit(AstAssignExpression node, Object data) | public Object | visit(AstBitwiseAndAssignExpression node, Object data) | public Object | visit(AstBitwiseAndExpression node, Object data) | public Object | visit(AstBitwiseComplementExpression node, Object data) | public Object | visit(AstBitwiseOrAssignExpression node, Object data) | public Object | visit(AstBitwiseOrExpression node, Object data) | public Object | visit(AstBitwiseXOrAssignExpression node, Object data) | public Object | visit(AstBitwiseXOrExpression node, Object data) | public Object | visit(AstBlock node, Object data) | public Object | visit(AstBreakStatement node, Object data) | public Object | visit(AstCase node, Object data) | public Object | visit(AstCastExpression node, Object data) | public Object | visit(AstCatchBlock node, Object data) | public Object | visit(AstConditionalAndExpression node, Object data) | public Object | visit(AstConditionalOrExpression node, Object data) | public Object | visit(AstContent node, Object data) | public Object | visit(AstContinueStatement node, Object data) | public Object | visit(AstDivideAssignExpression node, Object data) | public Object | visit(AstDivideExpression node, Object data) | public Object | visit(AstDoStatement node, Object data) | public Object | visit(AstEmptyStatement node, Object data) | public Object | visit(AstEQExpression node, Object data) | public Object | visit(AstField node, Object data) | public Object | visit(AstFieldDeclaration node, Object data) | public Object | visit(AstFieldReference node, Object data) | public Object | visit(AstFinallyBlock node, Object data) | public Object | visit(AstForInit node, Object data) | public Object | visit(AstFormalParameter node, Object data) | public Object | visit(AstFormalParameters node, Object data) | public Object | visit(AstForStatement node, Object data) | public Object | visit(AstForUpdate node, Object data) | public Object | visit(AstGEExpression node, Object data) | public Object | visit(AstGTExpression node, Object data) | public Object | visit(AstHookExpression node, Object data) | public Object | visit(AstIfStatement node, Object data) | public Object | visit(AstImportDeclaration node, Object data) | public Object | visit(AstInstanceOfExpression node, Object data) | public Object | visit(AstJxpDocument node, Object data) | public Object | visit(AstLabeledStatement node, Object data) | public Object | visit(AstLEExpression node, Object data) | public Object | visit(AstLiteral node, Object data) | public Object | visit(AstLogicalComplementExpression node, Object data) | public Object | visit(AstLShiftAssignExpression node, Object data) | public Object | visit(AstLShiftExpression node, Object data) | public Object | visit(AstLTExpression node, Object data) | public Object | visit(AstMethodCall node, Object data) | public Object | visit(AstFunctionDeclaration node, Object data) | public Object | visit(AstFunctionDeclarator node, Object data) | public Object | visit(AstMethodInvocation node, Object data) | public Object | visit(AstMinusAssignExpression node, Object data) | public Object | visit(AstMinusExpression node, Object data) | public Object | visit(AstMultiplyAssignExpression node, Object data) | public Object | visit(AstMultiplyExpression node, Object data) | public Object | visit(AstName node, Object data) | public Object | visit(AstNameList node, Object data) | public Object | visit(AstNEExpression node, Object data) | public Object | visit(AstObjectAllocationExpression node, Object data) | public Object | visit(AstPlusAssignExpression node, Object data) | public Object | visit(AstPlusExpression node, Object data) | public Object | visit(AstPostDecrementExpression node, Object data) | public Object | visit(AstPostIncrementExpression node, Object data) | public Object | visit(AstPreDecrementExpression node, Object data) | public Object | visit(AstPreIncrementExpression node, Object data) | public Object | visit(AstPrimaryExpression node, Object data) | public Object | visit(AstPrimarySuffix node, Object data) | public Object | visit(AstPrimitiveType node, Object data) | public Object | visit(AstPrintStatement node, Object data) | public Object | visit(AstRemainderExpression node, Object data) | public Object | visit(AstRemAssignExpression node, Object data) | public Object | visit(AstReturnStatement node, Object data) | public Object | visit(AstRSignedShiftAssignExpression node, Object data) | public Object | visit(AstRSignedShiftExpression node, Object data) | public Object | visit(AstRUnsignedShiftAssignExpression node, Object data) | public Object | visit(AstRUnsignedShiftExpression node, Object data) | public Object | visit(AstStatementExpressionList node, Object data) | public Object | visit(AstSwitchStatement node, Object data) | public Object | visit(AstSynchronizedStatement node, Object data) | public Object | visit(AstThrowStatement node, Object data) | public Object | visit(AstTryStatement node, Object data) | public Object | visit(AstUnaryMinusExpression node, Object data) | public Object | visit(AstUnaryPlusExpression node, Object data) | public Object | visit(AstVariableDeclarator node, Object data) | public Object | visit(AstWhileStatement node, Object data) | public Object | visit(SimpleNode node, Object data) | public Object | visit(AstType node, Object data) | public Object | visit(AstVariableDeclaratorId node, Object data) | public Object | visit(AstExitStatement node, Object data) | public Object | visit(AstStaticImportDeclaration node, Object data) | public Object | visit(AstVariableParameters node, Object data) | public Object | visit(AstEnhancedForStatement node, Object data) | public Object | visit(AstNamedArgument node, Object data) | public Object | visit(AstPageDirective node, Object data) | public Object | visit(AstIncludeDirective node, Object data) | public Object | visit(AstIsEmptyExpression node, Object data) |
JxpProcessor | public JxpProcessor(JxpContext context)(Code) | | Constructor
Parameters: source - the page source |
assignVariable | protected Object assignVariable(String name, Object value)(Code) | | Assign a variable in a current nametable stack to the value
Parameters: name - the variable name Parameters: value - the value the value assigned |
callFunction | protected Object callFunction(String methodName, Object[] args) throws Exception(Code) | | Call the function of the processor. Call predefined print or println if the method name matched. Otherwise, reflection will
be used on the processor to invoke method
Parameters: methodName - the method name Parameters: args - the arguments the value returned by the method call throws: Exception - if there's problem calling method |
declareFunctionLocals | public void declareFunctionLocals(String functionName, SimpleNode params, Object[] args) throws Exception(Code) | | Create the function environment
Parameters: params - the parameters Parameters: args - the arguments |
getCurrentContext | public JxpProcessingContext getCurrentContext()(Code) | | Get the current processing context
the current processing context |
getEnvironment | public Map getEnvironment()(Code) | | Get current environment
the environment |
getMethodStats | public Counter getMethodStats()(Code) | | Get the method stats
the method stats |
includeCall | protected Object includeCall(String id) throws Exception(Code) | | Include another page as a part of current page and process it
Parameters: id - the id the object throws: Exception - if there's exception |
instantiate | protected Object instantiate(Class type, Object[] args) throws Exception(Code) | | Instantiate an instance of class type using the arguments
Parameters: type - the type to instantiate Parameters: args - the arguments the object instantiated throws: Exception - if there's problem in the instantiation |
invokeMethod | protected Object invokeMethod(Object obj, String methodName, Object[] args) throws Exception(Code) | | Invoke the method of object obj with given argument
Parameters: obj - the object Parameters: methodName - the method name Parameters: args - the arguments the value return by the method invoked throws: Exception - if there's problem invoking the method |
isCheckFunctionArgumentType | final protected boolean isCheckFunctionArgumentType()(Code) | | Return the checkFunctionArgumentType
the checkFunctionArgumentType. |
print | protected void print(Object o) throws IOException(Code) | | print the object by printing o.toString() using writer of current context. If the object is null, "null" will be printed.
Parameters: o - the object throws: IOException - if there's problem doing the printing |
print | protected void print(String s) throws IOException(Code) | | Print the string using writer of current context
Parameters: s - the string throws: IOException - if there's io problem TODO: make to flag IOException to avoid call writes again |
println | protected void println(Object o) throws IOException(Code) | | print the object with the line delimiter "\n"
Parameters: o - the object throws: IOException - if there's problem doing the printing |
println | protected void println(String s) throws IOException(Code) | | print the object with the line delimiter "\n"
Parameters: s - the string throws: IOException - if there's problem doing the printing |
process | public Object process(String id, Writer writer, Map env) throws Exception(Code) | | process the page identified by id with the context given
Parameters: id - the id Parameters: env - the environment value return by this page throws: Exception - if there's problem doing the printing |
processCall | protected Object processCall(String id) throws Exception(Code) | | Process a page identified by id in current context
Parameters: id - the id the value return by the page throws: Exception - if there's problem doing the printing |
resolveArguments | protected Object[] resolveArguments(AstArguments node, JxpProcessingContext context) throws Exception(Code) | | Resolve the arguments for function or method call
Parameters: node - the node Parameters: context - the context object array containing the resolved argument values throws: Exception - if there's problem |
resolveArrayDims | protected int[] resolveArrayDims(AstArrayDims node, JxpProcessingContext context) throws Exception(Code) | | Resolve the array dimensions needed
Parameters: node - the ArrayDims node Parameters: context - the processing context the int array containing the dimensions info throws: Exception - if there's problem resolving the dimension |
resolveAssignmentTarget | protected Assignable resolveAssignmentTarget(SimpleNode node, boolean throwException) throws ProcessingException(Code) | | Resolve the assignment target. Exception will be thrown if the node is not assignable and throwExcpetion is true. Otherwise
null will be return if the node cannot be resolved to assignment target.
Parameters: node - the simple node or the target Parameters: throwException - whether to throw exception the target throws: ProcessingException - if the target cannot be resolved |
resolveClass | final protected Class resolveClass(String className)(Code) | | Resolve the class. Call the current context for resolving since the imports in context specific
Parameters: className - the class name the class |
resolveField | protected Object resolveField(Object obj, String fieldName) throws Exception(Code) | | Resolve the field on and object. Also resolve the array length field
Parameters: obj - the object Parameters: fieldName - the field name the field value throws: Exception - if the field cannot be resolved |
resolveName | protected Object resolveName(List l) throws Exception(Code) | | Resolve a object given the name in current processing context. It cound be variable, or class
Parameters: l - containing series of identifier the object associated with the name throws: Exception - if there's problem resolving the name |
setCheckFunctionArgumentType | final protected void setCheckFunctionArgumentType(boolean checkFunctionArgumentType)(Code) | | Set the checkFunctionArgumentType
Parameters: checkFunctionArgumentType - The checkFunctionArgumentType to set. |
setDoMethodStats | public void setDoMethodStats(boolean flag)(Code) | | |
|
|