List of usage examples for java.util EventObject getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.cleverbus.api.event.EventNotifierBase.java
/** * {@inheritDoc}/*from ww w .jav a 2s. com*/ * * @param event the event * @return {@code true} if {@link EventObject} is instance of generic T, otherwise {@code false} */ @Override public boolean isEnabled(EventObject event) { return eventClass.isAssignableFrom(event.getClass()); }
From source file:net.pandoragames.far.ui.swing.component.MacOSXMenuAdapter.java
/** * Implementation of the InvocationHandler interface. * @param proxy the proxy instance that the method was invoked on. * @param method the Method instance corresponding to the interface method invoked. * This is supposed to be one of the methods of class * <code>com.apple.eawt.ApplicationListener</code> * @param args method arguments, i.e. an instance of * <code>com.apple.eawt.ApplicationEvent</code> *///from ww w. j av a 2 s. c om public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); logger.debug("Callback for method " + methodName + " received"); if (validateCallParameter(methodName, args) && canHandle(methodName)) { try { EventObject osxEvent = (EventObject) args[0]; OSXActionEvent actionEvent = new OSXActionEvent(methodName, osxEvent); fireOSXEvent(actionEvent); // mark the event object as handled Method setHandledMethod = osxEvent.getClass().getDeclaredMethod("setHandled", new Class[] { boolean.class }); setHandledMethod.invoke(osxEvent, new Object[] { Boolean.TRUE }); } catch (Exception erx) { logger.error(erx.getClass().getName() + " handling call to method " + methodName + ": " + erx.getMessage(), erx); } } // void methods return null return null; }
From source file:org.apache.camel.management.JmxNotificationEventNotifier.java
public void notify(EventObject event) throws Exception { if (notificationBroadcaster != null) { // its recommended to send light weight events and we don't want to have the entire Exchange/CamelContext etc // serialized as these are the typical source of the EventObject. So we use our own source which is just // a human readable name, which can be configured. String type = event.getClass().getSimpleName(); String message = event.toString(); Notification notification = new Notification(type, source, counter.getAndIncrement(), message); if (LOG.isTraceEnabled()) { LOG.trace("Broadcasting JMX notification: " + notification); }/*from www .j av a 2 s. co m*/ notificationBroadcaster.sendNotification(notification); } }