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
| 28 | * @author crazybob@google.com (Bob Lee) |
| 29 | */ |
| 30 | public 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 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…