Package ognl
Class SimpleNode
java.lang.Object
ognl.SimpleNode
- All Implemented Interfaces:
Serializable,JavaSource,Node
- Direct Known Subclasses:
ASTChain,ASTConst,ASTCtor,ASTInstanceof,ASTList,ASTMethod,ASTProperty,ASTSequence,ASTStaticField,ASTStaticMethod,ASTVarRef,ExpressionNode
- Author:
- Luke Blanshard (blanshlu@netscape.net), Drew Davidson (drew@ognl.org)
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddump(PrintWriter writer, String prefix) protected ObjectevaluateGetValueBody(OgnlContext context, Object source) protected voidevaluateSetValueBody(OgnlContext context, Object target, Object value) protected voidThis method may be called from subclasses' jjtClose methods.Gets the compiled bytecode enhanced expression accessor for getting/setting values.intfinal ObjectgetValue(OgnlContext context, Object source) Extracts the value from the given source object that is appropriate for this node within the given context.protected abstract ObjectgetValueBody(OgnlContext context, Object source) Subclasses implement this method to do the actual work of extracting the appropriate value from the source object.booleanisConstant(OgnlContext context) booleanisNodeConstant(OgnlContext context) Returns true iff this node is constant without respect to the children.booleanisNodeSimpleProperty(OgnlContext context) booleanisSimpleNavigationChain(OgnlContext context) booleanisSimpleProperty(OgnlContext context) voidjjtAddChild(Node n, int i) This method tells the node to add its argument to the node's list of children.voidjjtClose()This method is called after all the child nodes have been added.jjtGetChild(int i) This method returns a child node.intReturn the number of children the node has.voidjjtOpen()This method is called after the node has been made the current node.voidjjtSetParent(Node n) This pair of methods are used to inform the node of its parent.protected booleanlastChild(OgnlContext context) voidsetAccessor(ExpressionAccessor accessor) Sets a new compiled accessor for this node expression.final voidsetValue(OgnlContext context, Object target, Object value) Sets the given value in the given target as appropriate for this node within the given context.protected voidsetValueBody(OgnlContext context, Object target, Object value) Subclasses implement this method to do the actual work of setting the appropriate value in the target object.toGetSourceString(OgnlContext context, Object target) Expected to return a java source representation of itself such that it could be turned into a literal java expression to be compiled and executed forExpressionAccessor.get(OgnlContext, Object)calls.toSetSourceString(OgnlContext context, Object target) Expected to return a java source representation of itself such that it could be turned into a literal java expression to be compiled and executed forExpressionAccessor.get(OgnlContext, Object)calls.toString()
-
Field Details
-
_parent
-
_children
-
_id
protected int _id -
_parser
-
-
Constructor Details
-
SimpleNode
public SimpleNode(int i) -
SimpleNode
-
-
Method Details
-
jjtOpen
public void jjtOpen()Description copied from interface:NodeThis method is called after the node has been made the current node. It indicates that child nodes can now be added to it. -
jjtClose
public void jjtClose()Description copied from interface:NodeThis method is called after all the child nodes have been added. -
jjtSetParent
Description copied from interface:NodeThis pair of methods are used to inform the node of its parent.- Specified by:
jjtSetParentin interfaceNode
-
jjtGetParent
- Specified by:
jjtGetParentin interfaceNode
-
jjtAddChild
Description copied from interface:NodeThis method tells the node to add its argument to the node's list of children.- Specified by:
jjtAddChildin interfaceNode
-
jjtGetChild
Description copied from interface:NodeThis method returns a child node. The children are numbered from zero, left to right.- Specified by:
jjtGetChildin interfaceNode
-
jjtGetNumChildren
public int jjtGetNumChildren()Description copied from interface:NodeReturn the number of children the node has.- Specified by:
jjtGetNumChildrenin interfaceNode
-
toString
-
toString
-
toGetSourceString
Description copied from interface:JavaSourceExpected to return a java source representation of itself such that it could be turned into a literal java expression to be compiled and executed forExpressionAccessor.get(OgnlContext, Object)calls.- Specified by:
toGetSourceStringin interfaceJavaSource- Returns:
- Literal java string representation of an object get.
-
toSetSourceString
Description copied from interface:JavaSourceExpected to return a java source representation of itself such that it could be turned into a literal java expression to be compiled and executed forExpressionAccessor.get(OgnlContext, Object)calls.- Specified by:
toSetSourceStringin interfaceJavaSource- Returns:
- Literal java string representation of an object get.
-
dump
-
getIndexInParent
public int getIndexInParent() -
getNextSibling
-
evaluateGetValueBody
- Throws:
OgnlException
-
evaluateSetValueBody
protected void evaluateSetValueBody(OgnlContext context, Object target, Object value) throws OgnlException - Throws:
OgnlException
-
getValue
Description copied from interface:NodeExtracts the value from the given source object that is appropriate for this node within the given context.- Specified by:
getValuein interfaceNode- Throws:
OgnlException
-
getValueBody
Subclasses implement this method to do the actual work of extracting the appropriate value from the source object.- Throws:
OgnlException
-
setValue
Description copied from interface:NodeSets the given value in the given target as appropriate for this node within the given context.- Specified by:
setValuein interfaceNode- Throws:
OgnlException
-
setValueBody
Subclasses implement this method to do the actual work of setting the appropriate value in the target object. The default implementation throws anInappropriateExpressionException, meaning that it cannot be a set expression.- Throws:
OgnlException
-
isNodeConstant
Returns true iff this node is constant without respect to the children.- Throws:
OgnlException
-
isConstant
- Throws:
OgnlException
-
isNodeSimpleProperty
- Throws:
OgnlException
-
isSimpleProperty
- Throws:
OgnlException
-
lastChild
-
flattenTree
protected void flattenTree()This method may be called from subclasses' jjtClose methods. It flattens the tree under this node by eliminating any children that are of the same class as this node and copying their children to this node. -
getAccessor
Description copied from interface:NodeGets the compiled bytecode enhanced expression accessor for getting/setting values.- Specified by:
getAccessorin interfaceNode- Returns:
- The accessor for this node, or null if none has been compiled for it.
-
setAccessor
Description copied from interface:NodeSets a new compiled accessor for this node expression.- Specified by:
setAccessorin interfaceNode- Parameters:
accessor- The compiled representation of this node.
-