Class FunctorMethodHandler

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

public class FunctorMethodHandler extends Object implements IMethodHandler, IAttributeSupport
  • Constructor Details

    • FunctorMethodHandler

      public FunctorMethodHandler(String name, IFunctor invoker)
  • Method Details

    • create

      public static IMethodHandler create(IFunctor functor)
    • getAttribute

      public Object getAttribute(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 String getName()
    • invoke

      public Object invoke(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 Object removeAttribute(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 Object setAttribute(Object key, 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