MCPcopy Index your code
hub / github.com/google/guice / Scope

Interface Scope

core/src/com/google/inject/Scope.java:30–53  ·  view source on GitHub ↗

A scope is a level of visibility that instances provided by Guice may have. By default, an instance created by the Injector has no scope , meaning it has no state from the framework's perspective -- the Injector creates it, injects it once into the class that required it, and t

Source from the content-addressed store, hash-verified

28 * @author crazybob@google.com (Bob Lee)
29 */
30public interface Scope {
31
32 /**
33 * Scopes a provider. The returned provider returns objects from this scope. If an object does not
34 * exist in this scope, the provider can use the given unscoped provider to retrieve one.
35 *
36 * <p>Scope implementations are strongly encouraged to override {@link Object#toString} in the
37 * returned provider and include the backing provider's {@code toString()} output.
38 *
39 * @param key binding key
40 * @param unscoped locates an instance when one doesn't already exist in this scope.
41 * @return a new provider which only delegates to the given unscoped provider when an instance of
42 * the requested object doesn't already exist in this scope
43 */
44 public <T> Provider<T> scope(Key<T> key, Provider<T> unscoped);
45
46 /**
47 * A short but useful description of this scope. For comparison, the standard scopes that ship
48 * with guice use the descriptions {@code "Scopes.SINGLETON"}, {@code "ServletScopes.SESSION"} and
49 * {@code "ServletScopes.REQUEST"}.
50 */
51 @Override
52 String toString();
53}

Callers 11

scopeMethod · 0.95
scopeMethod · 0.65
visitScopeMethod · 0.65
validateDependenciesMethod · 0.65
asModuleChainMethod · 0.65
assertFailureMethod · 0.65
configureMethod · 0.65

Implementers 13

TestScopecore/test/com/googlecode/guice/Jakarta
TwoAtATimeScopecore/test/com/google/inject/BinderTest
RememberProviderScopecore/test/com/google/inject/ScopesTest
ProviderGetScopecore/test/com/google/inject/ScopesTest
BasicSingletoncore/test/com/google/inject/CircularDe
SingleUseScopecore/test/com/google/inject/util/Overr
SingletonScopecore/src/com/google/inject/internal/Si
TestScopeextensions/throwingproviders/test/com/
RequestScopeextensions/servlet/src/com/google/inje
SessionScopeextensions/servlet/src/com/google/inje
OverrideModuleTestcore/test/com/google/inject/util/Overr
Scopescore/src/com/google/inject/Scopes.java

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…