Class NoopEventManager
java.lang.Object
org.apache.cayenne.event.NoopEventManager
- All Implemented Interfaces:
EventManager
- Since:
- 4.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<L, E extends EventObject>
voidaddListener(L listener, Class<E> eventClass, EventHandler<? super L, ? super E> handler, EventSubject subject) Registers a listener for events sent by any sender.<L, E extends EventObject>
voidaddListener(L listener, Class<E> eventClass, EventHandler<? super L, ? super E> handler, EventSubject subject, Object sender) Registers a listener for events sent by a specific sender.<L, E extends EventObject>
voidaddNonBlockingListener(L listener, Class<E> eventClass, EventHandler<? super L, ? super E> handler, EventSubject subject) Registers a listener for events sent by any sender, to be notified on a dispatch thread instead of the thread that posted the event.<L, E extends EventObject>
voidaddNonBlockingListener(L listener, Class<E> eventClass, EventHandler<? super L, ? super E> handler, EventSubject subject, Object sender) Registers a listener for events sent by a specific sender, to be notified on a dispatch thread instead of the thread that posted the event.booleanReturns true if this EventManager is single-threaded.voidpostEvent(EventObject event, EventSubject subject) Sends an event to all registered objects about a particular subject.voidpostNonBlockingEvent(EventObject event, EventSubject subject) Sends an event to all registered objects about a particular subject.booleanremoveAllListeners(EventSubject subject) Removes all listeners for a given subject.booleanremoveListener(Object listener) Unregister the specified listener from all event subjects handled by this manager instance.booleanremoveListener(Object listener, EventSubject subject) Unregister the specified listener for the events about the given subject.booleanremoveListener(Object listener, EventSubject subject, Object sender) Unregister the specified listener for the events about the given subject and the given sender.
-
Constructor Details
-
NoopEventManager
public NoopEventManager()
-
-
Method Details
-
isSingleThreaded
public boolean isSingleThreaded()Description copied from interface:EventManagerReturns true if this EventManager is single-threaded. If so it will throw an exception on any attempt to register an unblocking listener or dispatch a non-blocking event.- Specified by:
isSingleThreadedin interfaceEventManager
-
addListener
public <L, E extends EventObject> void addListener(L listener, Class<E> eventClass, EventHandler<? super L, ? super E> handler, EventSubject subject) Description copied from interface:EventManagerRegisters a listener for events sent by any sender.- Specified by:
addListenerin interfaceEventManager- Parameters:
listener- the object to be notified about eventseventClass- the class of events the listener is interested in; events of other types are ignoredhandler- the callback invoked with the listener and the event, normally an unbound method referencesubject- the event subject that the listener is interested in
-
addNonBlockingListener
public <L, E extends EventObject> void addNonBlockingListener(L listener, Class<E> eventClass, EventHandler<? super L, ? super E> handler, EventSubject subject) Description copied from interface:EventManagerRegisters a listener for events sent by any sender, to be notified on a dispatch thread instead of the thread that posted the event.- Specified by:
addNonBlockingListenerin interfaceEventManager- See Also:
-
addListener
public <L, E extends EventObject> void addListener(L listener, Class<E> eventClass, EventHandler<? super L, ? super E> handler, EventSubject subject, Object sender) Description copied from interface:EventManagerRegisters a listener for events sent by a specific sender.- Specified by:
addListenerin interfaceEventManager- Parameters:
listener- the object to be notified about eventseventClass- the class of events the listener is interested in; events of other types are ignoredhandler- the callback invoked with the listener and the event, normally an unbound method referencesubject- the event subject that the listener is interested insender- the object whose events the listener is interested in; null means 'any sender'
-
addNonBlockingListener
public <L, E extends EventObject> void addNonBlockingListener(L listener, Class<E> eventClass, EventHandler<? super L, ? super E> handler, EventSubject subject, Object sender) Description copied from interface:EventManagerRegisters a listener for events sent by a specific sender, to be notified on a dispatch thread instead of the thread that posted the event.- Specified by:
addNonBlockingListenerin interfaceEventManager
-
removeListener
Description copied from interface:EventManagerUnregister the specified listener from all event subjects handled by this manager instance.- Specified by:
removeListenerin interfaceEventManager- Parameters:
listener- the object to be unregistered- Returns:
trueiflistenercould be removed for any existing subjects, else returnsfalse.
-
removeAllListeners
Description copied from interface:EventManagerRemoves all listeners for a given subject.- Specified by:
removeAllListenersin interfaceEventManager
-
removeListener
Description copied from interface:EventManagerUnregister the specified listener for the events about the given subject.- Specified by:
removeListenerin interfaceEventManager- Parameters:
listener- the object to be unregisteredsubject- the subject from which the listener is to be unregistered- Returns:
trueiflistenercould be removed for the given subject, else returnsfalse.
-
removeListener
Description copied from interface:EventManagerUnregister the specified listener for the events about the given subject and the given sender.- Specified by:
removeListenerin interfaceEventManager- Parameters:
listener- the object to be unregisteredsubject- the subject from which the listener is to be unregisteredsender- the object whose events the listener was interested in;nullmeans 'any sender'.- Returns:
trueiflistenercould be removed for the given subject, else returnsfalse.
-
postEvent
Description copied from interface:EventManagerSends an event to all registered objects about a particular subject. Event is sent synchronously, so the sender thread is blocked until all the listeners finish processing the event.- Specified by:
postEventin interfaceEventManager
-
postNonBlockingEvent
Description copied from interface:EventManagerSends an event to all registered objects about a particular subject. Event is queued by EventManager, releasing the sender thread, and is later dispatched in a separate thread.- Specified by:
postNonBlockingEventin interfaceEventManager
-