Class ServletScopes.SessionScope

java.lang.Object
com.google.inject.servlet.ServletScopes.SessionScope
All Implemented Interfaces:
Scope
Enclosing class:
ServletScopes

private static final class ServletScopes.SessionScope extends Object implements Scope
  • Constructor Details

    • SessionScope

      private SessionScope()
  • Method Details

    • scope

      public <T> Provider<T> scope(Key<T> key, Provider<T> creator)
      Description copied from interface: Scope
      Scopes a provider. The returned provider returns objects from this scope. If an object does not exist in this scope, the provider can use the given unscoped provider to retrieve one.

      Scope implementations are strongly encouraged to override Object.toString() in the returned provider and include the backing provider's toString() output.

      Specified by:
      scope in interface Scope
      Parameters:
      key - binding key
      creator - locates an instance when one doesn't already exist in this scope.
      Returns:
      a new provider which only delegates to the given unscoped provider when an instance of the requested object doesn't already exist in this scope
    • toString

      public String toString()
      Description copied from interface: Scope
      A short but useful description of this scope. For comparison, the standard scopes that ship with guice use the descriptions "Scopes.SINGLETON", "ServletScopes.SESSION" and "ServletScopes.REQUEST".
      Specified by:
      toString in interface Scope
      Overrides:
      toString in class Object