use of com.tvd12.ezyfox.core.annotation.EzyEventHandler in project ezyfox-server by youngmonkeys.
the class EzySimpleAppEntry method addEventControllers.
private void addEventControllers(EzyAppContext appContext, EzyBeanContext beanContext) {
EzySetup setup = appContext.get(EzySetup.class);
List<Object> eventControllers = beanContext.getSingletons(EzyEventHandler.class);
sortEventHandlersByPriority(eventControllers);
for (Object controller : eventControllers) {
Class<?> controllerType = controller.getClass();
EzyEventHandler annotation = controllerType.getAnnotation(EzyEventHandler.class);
String eventName = EzyEventHandlerAnnotations.getEvent(annotation);
setup.addEventController(EzyEventType.valueOf(eventName), (EzyEventController) controller);
logger.info("add event {} controller {}", eventName, controller);
}
}
use of com.tvd12.ezyfox.core.annotation.EzyEventHandler in project ezyfox-server by youngmonkeys.
the class EzySimplePluginEntry method addEventControllers.
private void addEventControllers(EzyPluginContext context, EzyBeanContext beanContext) {
EzySetup setup = context.get(EzySetup.class);
List<Object> eventControllers = beanContext.getSingletons(EzyEventHandler.class);
sortEventHandlersByPriority(eventControllers);
for (Object controller : eventControllers) {
Class<?> handlerType = controller.getClass();
EzyEventHandler annotation = handlerType.getAnnotation(EzyEventHandler.class);
String eventName = EzyEventHandlerAnnotations.getEvent(annotation);
setup.addEventController(EzyEventType.valueOf(eventName), (EzyEventController) controller);
logger.info("add event {} controller {}", eventName, controller);
}
}
use of com.tvd12.ezyfox.core.annotation.EzyEventHandler in project ezyfox-server-android-client by youngmonkeys.
the class EzyEventHandlers method handle.
public void handle(EzyEvent event) {
EzyEventType eventType = event.getType();
EzyEventHandler handler = handlers.get(eventType);
if (handler != null)
handler.handle(event);
else
EzyLogger.warn("has no handler for event type: " + eventType);
}
Aggregations