Class ServletScopes.RequestScope

  • All Implemented Interfaces:
    Scope
    Enclosing class:
    ServletScopes

    private static final class ServletScopes.RequestScope
    extends java.lang.Object
    implements Scope
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private RequestScope()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> Provider<T> scope​(Key<T> key, Provider<T> creator)
      Scopes a provider.
      java.lang.String toString()
      A short but useful description of this scope.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • RequestScope

        private RequestScope()
    • Method Detail

      • 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 java.lang.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 java.lang.Object