Package pl.morgwai.base.guice.scopes
Class InducedContextScope<TrackableCtxT extends TrackableContext<TrackableCtxT>,InducedCtxT extends InjectionContext>
- java.lang.Object
-
- pl.morgwai.base.guice.scopes.ContextScope<TrackableCtxT>
-
- pl.morgwai.base.guice.scopes.InducedContextScope<TrackableCtxT,InducedCtxT>
-
- All Implemented Interfaces:
Scope
public class InducedContextScope<TrackableCtxT extends TrackableContext<TrackableCtxT>,InducedCtxT extends InjectionContext> extends ContextScope<TrackableCtxT>
Scopes objects to the context induced by the context obtained from the associatedContextTracker
. For example HTTP session context may be induced by HTTP servlet request context.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class pl.morgwai.base.guice.scopes.ContextScope
ContextScope.ScopedProvider<T>
-
-
Field Summary
-
Fields inherited from class pl.morgwai.base.guice.scopes.ContextScope
tracker
-
-
Constructor Summary
Constructors Constructor Description InducedContextScope(String name, ContextTracker<TrackableCtxT> tracker, Function<TrackableCtxT,InducedCtxT> inducer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected InjectionContext
getContext()
Returns a context instance from which scoped objects should be obtained by this Scope.-
Methods inherited from class pl.morgwai.base.guice.scopes.ContextScope
getName, scope, toString
-
-
-
-
Constructor Detail
-
InducedContextScope
public InducedContextScope(String name, ContextTracker<TrackableCtxT> tracker, Function<TrackableCtxT,InducedCtxT> inducer)
-
-
Method Detail
-
getContext
protected InjectionContext getContext()
Description copied from class:ContextScope
Returns a context instance from which scoped objects should be obtained by this Scope. By default returns directly the context obtained fromContextScope.tracker
. May be overridden to return some context induced by the one from theContextScope.tracker
.- Overrides:
getContext
in classContextScope<TrackableCtxT extends TrackableContext<TrackableCtxT>>
- See Also:
InducedContextScope
-
-