public class EventHandler
extends java.lang.Object
This class only verifies the suitability of the method and event type if something fails. Callers are expected t verify their uses of this class.
Two EventHandlers are equivalent when they refer to the same method on the same object (not class). This property is used to ensure that no handler method is registered more than once.
Constructor and Description |
---|
EventHandler(java.lang.Object target,
java.lang.reflect.Method method) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
void |
handleEvent(java.lang.Object event)
Invokes the wrapped handler method to handle
event . |
int |
hashCode() |
void |
invalidate()
If invalidated, will subsequently refuse to handle events.
|
boolean |
isValid() |
java.lang.String |
toString() |
public EventHandler(java.lang.Object target, java.lang.reflect.Method method)
public boolean isValid()
public void invalidate()
public void handleEvent(java.lang.Object event) throws java.lang.reflect.InvocationTargetException
event
.event
- event to handlejava.lang.IllegalStateException
- if previously invalidated.java.lang.reflect.InvocationTargetException
- if the wrapped method throws any Throwable
that is not
an Error
(Error
s are propagated as-is).public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object