org.apache.commons.ognl
Class ASTMethod

java.lang.Object
  extended by org.apache.commons.ognl.SimpleNode
      extended by org.apache.commons.ognl.ASTMethod
All Implemented Interfaces:
Serializable, OrderedReturn, JavaSource, Node, NodeType

public class ASTMethod
extends SimpleNode
implements OrderedReturn, NodeType

$Id: ASTMethod.java 1198659 2011-11-07 09:12:44Z mcucchiara $

Author:
Luke Blanshard (blanshlu@netscape.net), Drew Davidson (drew@ognl.org)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.commons.ognl.SimpleNode
children, id, parent, parser
 
Constructor Summary
ASTMethod(int id)
           
ASTMethod(OgnlParser p, int id)
           
 
Method Summary
<R,P> R
accept(NodeVisitor<? extends R,? super P> visitor, P data)
          Supports the Visitor pattern.
 String getCoreExpression()
          Get the core expression to execute first before any return foo logic is started.
 Class getGetterClass()
          The type returned from the expression - if any.
 String getLastExpression()
          Gets the last expression to be pre-pended with a return <expression> block.
 String getMethodName()
          Returns the method name that this node will call.
 Class getSetterClass()
          The type used to set the value - if any.
protected  Object getValueBody(OgnlContext context, Object source)
          Subclasses implement this method to do the actual work of extracting the appropriate value from the source object.
 void setMethodName(String methodName)
          Called from parser action.
 String 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 for ExpressionAccessor.get(OgnlContext, Object) calls.
 String 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 for ExpressionAccessor.get(OgnlContext, Object) calls.
 
Methods inherited from class org.apache.commons.ognl.SimpleNode
dump, evaluateGetValueBody, evaluateSetValueBody, flattenTree, getAccessor, getIndexInParent, getNextSibling, getValue, isConstant, isEvalChain, isNodeConstant, isNodeSimpleProperty, isSimpleNavigationChain, isSimpleProperty, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, lastChild, setAccessor, setValue, setValueBody, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ASTMethod

public ASTMethod(int id)

ASTMethod

public ASTMethod(OgnlParser p,
                 int id)
Method Detail

setMethodName

public void setMethodName(String methodName)
Called from parser action.

Parameters:
methodName - sets the name of the method

getMethodName

public String getMethodName()
Returns the method name that this node will call.

Returns:
the method name

getValueBody

protected Object getValueBody(OgnlContext context,
                              Object source)
                       throws OgnlException
Description copied from class: SimpleNode
Subclasses implement this method to do the actual work of extracting the appropriate value from the source object.

Specified by:
getValueBody in class SimpleNode
Throws:
OgnlException

getLastExpression

public String getLastExpression()
Description copied from interface: OrderedReturn
Gets the last expression to be pre-pended with a return <expression> block.

Specified by:
getLastExpression in interface OrderedReturn
Returns:
The expression representing the return portion of a statement;

getCoreExpression

public String getCoreExpression()
Description copied from interface: OrderedReturn
Get the core expression to execute first before any return foo logic is started.

Specified by:
getCoreExpression in interface OrderedReturn
Returns:
The core standalone expression that shouldn't be pre-pended with a return keyword.

getGetterClass

public Class getGetterClass()
Description copied from interface: NodeType
The type returned from the expression - if any.

Specified by:
getGetterClass in interface NodeType
Returns:
The type.

getSetterClass

public Class getSetterClass()
Description copied from interface: NodeType
The type used to set the value - if any.

Specified by:
getSetterClass in interface NodeType
Returns:
The type.

toGetSourceString

public String toGetSourceString(OgnlContext context,
                                Object target)
Description copied from interface: JavaSource
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 for ExpressionAccessor.get(OgnlContext, Object) calls.

Specified by:
toGetSourceString in interface JavaSource
Overrides:
toGetSourceString in class SimpleNode
Returns:
Literal java string representation of an object get.

toSetSourceString

public String toSetSourceString(OgnlContext context,
                                Object target)
Description copied from interface: JavaSource
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 for ExpressionAccessor.get(OgnlContext, Object) calls.

Specified by:
toSetSourceString in interface JavaSource
Overrides:
toSetSourceString in class SimpleNode
Returns:
Literal java string representation of an object get.

accept

public <R,P> R accept(NodeVisitor<? extends R,? super P> visitor,
                      P data)
         throws OgnlException
Description copied from interface: Node
Supports the Visitor pattern. The method which corresponds to the runtime type of this Node will be called.

Specified by:
accept in interface Node
Type Parameters:
R - The return type of the visitor.visit method.
P - The type of the second parameter type.
Parameters:
visitor - The visitor to accept.
data - The second parameter to pass through to visitor.visit
Returns:
the value returned by visitor.visit
Throws:
OgnlException


Copyright © 1997-2013 The Apache Software Foundation. All Rights Reserved.