spin.off
Class ListenerSpinOver
Evaluator
spin.off.ListenerSpinOver
public class ListenerSpinOver
extends Evaluator
An evaluator for spin-off that automatically spins-over all arguments of a
SpinOffEvaluator
if their corresponding parameter types are
subinterfaces of
java.util.EventListener
.
Use an instance of this class on construction of a
Spin object or
install it globally by calling the static method:
Spin.setDefaultOffEvaluator(new ListenerSpinOver());
isListenerAdditionOrRemoval(java.lang.reflect.Method)
, isListener(java.lang.Class)
void | evaluate(Invocation invocation)
|
protected boolean | isListener(Class type) - Test if the given class is a listener subinterface.
|
protected boolean | isListenerAdditionOrRemoval(Method method) - Test if the given method is a listener addition or removal.
|
protected Object | spinOver(Object object) - Spin-over the given object.
|
ListenerSpinOver
public ListenerSpinOver()
Constructor.
ListenerSpinOver
public ListenerSpinOver(Evaluator evaluator)
Constructor.
evaluator
- the evaluator to wrap
evaluate
public void evaluate(Invocation invocation)
throws Throwable
isListener
protected boolean isListener(Class type)
Test if the given class is a listener subinterface.
true
if the class is an sub-interface of
java.util.EventListener
isListenerAdditionOrRemoval
protected boolean isListenerAdditionOrRemoval(Method method)
Test if the given method is a listener addition or removal. For this the
methods name must obey the name pattern
(add|remove).*Listener
.
true
if method obeys the name pattern of listener
addition or removal
spinOver
protected Object spinOver(Object object)
Spin-over the given object.
object
- object to spin-over