org.webmacro.util
Class PropertyMethod

java.lang.Object
  |
  +--org.webmacro.util.PropertyMethod
All Implemented Interfaces:
Named

public final class PropertyMethod
extends java.lang.Object
implements Named

A property method can function as part of a name in a property, and represents a method call that should be used to resolve that portion of the name.

For example: a.b.get("C").d is equivalent to a.b.hi.d, you can also use this to access methods which are not normally available through the regular introspection algorithms, for example: #set $thing = a.get("thing")

The arguments supplied to a PropertyMethod can be a list including Macro objects which need to be resolved against a context. The introspection process will supply the context and resolve these references at execution time.


Constructor Summary
PropertyMethod(java.lang.String name, Macro args)
          Create a new PropertyMethod
PropertyMethod(java.lang.String name, java.lang.Object[] args)
          Create a new PropertyMethod
 
Method Summary
 java.lang.Object[] getArguments(Context context)
          Return the arguments for this method, after resolving them against the supplied context.
 java.lang.String getName()
          Return the name of this PropertyMethod
 java.lang.String toString()
          Return a signature of this method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyMethod

public PropertyMethod(java.lang.String name,
                      java.lang.Object[] args)
Create a new PropertyMethod
Parameters:
name - the name of the method to call
args - the arguments, including Macro objects

PropertyMethod

public PropertyMethod(java.lang.String name,
                      Macro args)
Create a new PropertyMethod
Parameters:
name - the name of the method to call
args - the arguments, including Macro objects
Method Detail

getName

public final java.lang.String getName()
Return the name of this PropertyMethod
Specified by:
getName in interface Named

toString

public final java.lang.String toString()
Return a signature of this method
Overrides:
toString in class java.lang.Object

getArguments

public final java.lang.Object[] getArguments(Context context)
                                      throws PropertyException
Return the arguments for this method, after resolving them against the supplied context. Any arguments which are of type Macro will be resolved into a regular object via the Macro.evaluate method.
Throws:
PropertyException - a Macro in the arguments failed to resolve against the supplied context