class EventSubscriber
extends java.lang.Object
This class only verifies the suitability of the method and event type if something fails. Callers are expected to verify their uses of this class.
Two EventSubscribers are equivalent when they refer to the same method on the same object (not class). This property is used to ensure that no subscriber method is registered more than once.
| Modifier and Type | Field and Description |
|---|---|
private java.lang.reflect.Method |
method
Subscriber method.
|
private java.lang.Object |
target
Object sporting the subscriber method.
|
| Constructor and Description |
|---|
EventSubscriber(java.lang.Object target,
java.lang.reflect.Method method)
Creates a new EventSubscriber to wrap
method on @{code target}. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.reflect.Method |
getMethod() |
java.lang.Object |
getSubscriber() |
void |
handleEvent(java.lang.Object event)
Invokes the wrapped subscriber method to handle
event. |
int |
hashCode() |
java.lang.String |
toString() |
private final java.lang.Object target
private final java.lang.reflect.Method method
EventSubscriber(java.lang.Object target,
java.lang.reflect.Method method)
method on @{code target}.target - object to which the method applies.method - subscriber method.public void handleEvent(java.lang.Object event)
throws java.lang.reflect.InvocationTargetException
event.event - event to handlejava.lang.reflect.InvocationTargetException - if the wrapped method throws any
Throwable that is not an Error (Error instances are
propagated as-is).public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(@Nullable
java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.Object getSubscriber()
public java.lang.reflect.Method getMethod()