Package org.apache.cayenne.di.spi
Class DefaultScope
- java.lang.Object
-
- org.apache.cayenne.di.spi.DefaultScope
-
-
Field Summary
Fields Modifier and Type Field Description protected Collection<Class<? extends Annotation>>
eventTypes
protected ConcurrentMap<String,Collection<ScopeEventBinding>>
listeners
-
Constructor Summary
Constructors Constructor Description DefaultScope(Class<? extends Annotation>... customEventTypes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addScopeEventListener(Object object)
Registers annotated methods of an arbitrary object for this scope lifecycle events.void
postScopeEvent(Class<? extends Annotation> type, Object... eventParameters)
Posts a scope event to all registered listeners.void
removeScopeEventListener(Object object)
<T> Provider<T>
scope(Provider<T> unscoped)
void
shutdown()
Shuts down this scope, postingBeforeScopeEnd
andAfterScopeEnd
events.
-
-
-
Field Detail
-
eventTypes
protected Collection<Class<? extends Annotation>> eventTypes
-
listeners
protected ConcurrentMap<String,Collection<ScopeEventBinding>> listeners
-
-
Constructor Detail
-
DefaultScope
@SafeVarargs public DefaultScope(Class<? extends Annotation>... customEventTypes)
-
-
Method Detail
-
shutdown
public void shutdown()
Shuts down this scope, postingBeforeScopeEnd
andAfterScopeEnd
events.
-
addScopeEventListener
public void addScopeEventListener(Object object)
Registers annotated methods of an arbitrary object for this scope lifecycle events.
-
removeScopeEventListener
public void removeScopeEventListener(Object object)
-
postScopeEvent
public void postScopeEvent(Class<? extends Annotation> type, Object... eventParameters)
Posts a scope event to all registered listeners. There's no predetermined order of event dispatching. An exception thrown by any of the listeners stops further event processing and is rethrown.
-
-