de.intarsys.tools.functor
Class FunctorMethodHandler

java.lang.Object
  extended by de.intarsys.tools.functor.FunctorMethodHandler
All Implemented Interfaces:
IAttributeSupport, IMethodHandler

public class FunctorMethodHandler
extends java.lang.Object
implements IMethodHandler, IAttributeSupport


Constructor Summary
FunctorMethodHandler(java.lang.String name, IFunctor invoker)
           
 
Method Summary
static IMethodHandler create(IFunctor functor)
           
 java.lang.Object getAttribute(java.lang.Object key)
          Get an attribute value from the context
 IFunctor getInvoker()
           
 java.lang.String getName()
           
 java.lang.Object invoke(java.lang.Object receiver, IArgs args)
          Execute the implementation associated with this method in the context of the receiver and return the result.
 java.lang.Object removeAttribute(java.lang.Object key)
          Remove an attribute binding in the context
 java.lang.Object setAttribute(java.lang.Object key, java.lang.Object value)
          Set the value of an attribute in the context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctorMethodHandler

public FunctorMethodHandler(java.lang.String name,
                            IFunctor invoker)
Method Detail

create

public static IMethodHandler create(IFunctor functor)

getAttribute

public java.lang.Object getAttribute(java.lang.Object key)
Description copied from interface: IAttributeSupport
Get an attribute value from the context

Specified by:
getAttribute in interface IAttributeSupport
Parameters:
key - the name of the attribute to get
Returns:
The value of the attribute key

getInvoker

public IFunctor getInvoker()

getName

public java.lang.String getName()

invoke

public java.lang.Object invoke(java.lang.Object receiver,
                               IArgs args)
                        throws MethodInvocationException
Description copied from interface: IMethodHandler
Execute the implementation associated with this method in the context of the receiver and return the result.

Specified by:
invoke in interface IMethodHandler
Parameters:
receiver - The object implementing the method.
args - The arguments for the invocation.
Returns:
The result of the invocation.
Throws:
MethodInvocationException

removeAttribute

public java.lang.Object removeAttribute(java.lang.Object key)
Description copied from interface: IAttributeSupport
Remove an attribute binding in the context

Specified by:
removeAttribute in interface IAttributeSupport
Parameters:
key - the name of the attribute to remove
Returns:
The previously associated value for key

setAttribute

public java.lang.Object setAttribute(java.lang.Object key,
                                     java.lang.Object value)
Description copied from interface: IAttributeSupport
Set the value of an attribute in the context

Specified by:
setAttribute in interface IAttributeSupport
Parameters:
key - the name of the attribute to set
value - the new value the attribute
Returns:
The previously associated value for key