org.jbpm.wire.operation
Class MethodInvokerListener

java.lang.Object
  extended by org.jbpm.wire.operation.MethodInvokerListener
All Implemented Interfaces:
java.io.Serializable, Listener

public class MethodInvokerListener
extends java.lang.Object
implements Listener, java.io.Serializable

Wrapper for the subscribe operation. This class will be used to call a specified method on reception of an event. This class is used so that a non Listener class can subscribe to an Observable object.

Author:
Tom Baeyens, Guillaume Porcher (Documentation)
See Also:
SubscribeOperation, Serialized Form

Constructor Summary
MethodInvokerListener(java.lang.String methodName, java.util.List<ArgDescriptor> argDescriptors, WireContext wireContext, java.lang.Object target)
          Creates a new Wrapper.
 
Method Summary
 void event(java.lang.Object source, java.lang.String eventName, java.lang.Object info)
          Method called by the Observable when an event is fired.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodInvokerListener

public MethodInvokerListener(java.lang.String methodName,
                             java.util.List<ArgDescriptor> argDescriptors,
                             WireContext wireContext,
                             java.lang.Object target)
Creates a new Wrapper. When an event is received, the arguments args are created from the list argDescriptors, and target.methodName(args) is called.

Parameters:
methodName - name of the method to call when an event is received.
argDescriptors - list of descriptors of arguments given to the method.
wireContext - context to use to create the arguments
target - object on which the method will be called.
Method Detail

event

public void event(java.lang.Object source,
                  java.lang.String eventName,
                  java.lang.Object info)
Description copied from interface: Listener
Method called by the Observable when an event is fired.

Specified by:
event in interface Listener
Parameters:
source - Observable that fired the event.
eventName - name of the event.
info - informations about the fired event.