E - the event type to handlepublic class AnnotationEventHandler<E extends Event> extends AbstractNamedEventHandler<E> implements EventHandler<E>, UIMessages
| Modifier and Type | Field and Description |
|---|---|
private Annotation |
annotation
The OnXxxxx annotation that define which handler to manage.
|
private Object |
callbackObject
The object used to handle the triggered event.
|
private static JRLogger |
LOGGER
The class logger.
|
ANIM_ANNO_PROCESSING_FAILURE, CREATION_FAILURE, EVENT_HANDLING_IMPOSSIBLE, NO_EVENT_CALLBACK, NODE_ANNO_PROCESSING_FAILURE, VIEW_ANNO_PROCESSING_FAILURE| Constructor and Description |
|---|
AnnotationEventHandler(Object callbackObject,
Annotation annotation)
Default Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private String |
buildHandlingMethodName(EnumEventType annotationType)
Build the handling method name used to manage this event.
|
private void |
callMethod(String methodName,
Event event)
Call the method into the callback object.
|
private void |
checkCallbackMethods()
For each annotation event type, check if the callback method exists.
|
private EnumEventType |
convertEventToEnum(EventType<? extends Event> eventType)
Convert a JavaFX event type into an annotation event type.
|
private Class<Event> |
getAnnotationApiEventClass()
Return the api event class used by the annotation.
|
private String |
getAnnotationName()
Return the name of the annotation to define the unique callback method name.
|
private EnumEventType[] |
getAnnotationValue()
Return the value of the annotation used to define type of handler to manage.
|
void |
handle(Event event) |
getName, toStringprivate static final JRLogger LOGGER
private final Annotation annotation
private final Object callbackObject
public AnnotationEventHandler(Object callbackObject, Annotation annotation) throws CoreException
callbackObject - the object that will handle the event by reflectionannotation - the annotation that configure the event handlingCoreException - if handler is not correctly initializedprivate void checkCallbackMethods()
throws CoreException
CoreException - an exception if the current class doesn't have the right handling methodpublic void handle(Event event)
handle in interface EventHandler<E extends Event>private String buildHandlingMethodName(EnumEventType annotationType)
annotationType - the custom annotation event type used to define the kind of event to manageprivate String getAnnotationName()
private EnumEventType[] getAnnotationValue()
private Class<Event> getAnnotationApiEventClass()
private EnumEventType convertEventToEnum(EventType<? extends Event> eventType)
eventType - the JavaFX event typeCopyright © 2011–2014 JRebirth OSS. All rights reserved.