Package io.bootique.di.spi
Class DefaultScope
java.lang.Object
io.bootique.di.spi.DefaultScope
- All Implemented Interfaces:
Scope
An implementation of a DI scopes with support scope events.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Collection<Class<? extends Annotation>>protected final Map<String,Collection<ScopeEventBinding>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddScopeEventListener(Object object) Registers annotated methods of an arbitrary object for this scope lifecycle events.voidpostScopeEvent(Class<? extends Annotation> type, Object... eventParameters) Posts a scope event to all registered listeners.voidremoveScopeEventListener(Object object) <T> javax.inject.Provider<T>scope(javax.inject.Provider<T> unscoped) voidshutdown()Shuts down this scope, postingBeforeScopeEndandAfterScopeEndevents.
-
Field Details
-
eventTypes
-
listeners
-
-
Constructor Details
-
DefaultScope
-
-
Method Details
-
shutdown
public void shutdown()Shuts down this scope, postingBeforeScopeEndandAfterScopeEndevents. -
addScopeEventListener
Registers annotated methods of an arbitrary object for this scope lifecycle events. -
removeScopeEventListener
-
postScopeEvent
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. -
scope
public <T> javax.inject.Provider<T> scope(javax.inject.Provider<T> unscoped)
-