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 IMethodHandler
create(IFunctor functor)
java.lang.Object
getAttribute(java.lang.Object key)
Get an attribute value from the contextIFunctor
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 thereceiver
and return the result.java.lang.Object
removeAttribute(java.lang.Object key)
Remove an attribute binding in the contextjava.lang.Object
setAttribute(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:IAttributeSupport
Get an attribute value from the context- Specified by:
getAttribute
in 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 MethodInvocationException
Description copied from interface:IMethodHandler
Execute the implementation associated with this method in the context of thereceiver
and return the result.- Specified by:
invoke
in 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:IAttributeSupport
Remove an attribute binding in the context- Specified by:
removeAttribute
in 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:IAttributeSupport
Set the value of an attribute in the context- Specified by:
setAttribute
in interfaceIAttributeSupport
- Parameters:
key
- the name of the attribute to setvalue
- the new value the attribute- Returns:
- The previously associated value for
key
-
-