com.google.inject
Interface Scope


public interface Scope

A scope which bound objects can reside in. Scopes a given Locator.

Scope implementations should override toString() in the returned locator and include the unscoped locator's toString() output. Doing so aids debugging. They should also override their own toString() method.

Author:
crazybob@google.com (Bob Lee)

Method Summary
<T> Locator<T>
scope(Key<T> key, Locator<T> unscoped)
          Scopes a locator.
 

Method Detail

scope

<T> Locator<T> scope(Key<T> key,
                     Locator<T> unscoped)
Scopes a locator. The returned locator returns objects from this scope. If an object does not exist in this scope, the locator can use the given unscoped locator to retrieve one.

Parameters:
key - binding key
unscoped - locates an instance when one doesn't already exist in this scope.
Returns:
a new locator which only delegates to the given unscoped locator when an instance of the requested object doesn't already exist in this scope