Package de.intarsys.tools.functor
Class FunctorMethodHandler
- java.lang.Object
-
- de.intarsys.tools.functor.FunctorMethodHandler
-
- All Implemented Interfaces:
IAttributeSupport,IMethodHandler
public class FunctorMethodHandler extends java.lang.Object implements IMethodHandler, IAttributeSupport
-
-
Constructor Summary
Constructors Constructor Description FunctorMethodHandler(java.lang.String name, IFunctor invoker)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IMethodHandlercreate(IFunctor functor)java.lang.ObjectgetAttribute(java.lang.Object key)Get an attribute value from the contextIFunctorgetInvoker()java.lang.StringgetName()java.lang.Objectinvoke(java.lang.Object receiver, IArgs args)Execute the implementation associated with this method in the context of thereceiverand return the result.java.lang.ObjectremoveAttribute(java.lang.Object key)Remove an attribute binding in the contextjava.lang.ObjectsetAttribute(java.lang.Object key, java.lang.Object value)Set the value of an attribute in the context
-
-
-
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:IAttributeSupportGet an attribute value from the context- Specified by:
getAttributein interfaceIAttributeSupport- 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 MethodInvocationExceptionDescription copied from interface:IMethodHandlerExecute the implementation associated with this method in the context of thereceiverand return the result.- Specified by:
invokein interfaceIMethodHandler- 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:IAttributeSupportRemove an attribute binding in the context- Specified by:
removeAttributein interfaceIAttributeSupport- 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:IAttributeSupportSet the value of an attribute in the context- Specified by:
setAttributein interfaceIAttributeSupport- Parameters:
key- the name of the attribute to setvalue- the new value the attribute- Returns:
- The previously associated value for
key
-
-