org.directwebremoting.guice.util
Interface ContextScope<C>

All Superinterfaces:
com.google.inject.Provider<C>, com.google.inject.Scope
All Known Implementing Classes:
AbstractContextScope, AbstractMapContextScope, AbstractSimpleContextScope

public interface ContextScope<C>
extends com.google.inject.Scope, com.google.inject.Provider<C>

A scope that looks up providers in a current context, using itself as a provider for the context.

Author:
Tim Peierls [tim at peierls dot net]

Method Summary
 void close(C context, ContextCloseHandler<?>... closeHandlers)
          Closes the given context.
 void closeAll(ContextCloseHandler<?>... closeHandlers)
          Closes all open contexts.
 C get()
          The context identifier used to look up an instance registry.
 java.util.List<com.google.inject.Key<?>> getKeysInScope()
          The keys bound in this scope.
 java.util.Collection<C> getOpenContexts()
          The context identifiers of all open contexts that this scope knows about.
<T> com.google.inject.Provider<T>
scope(com.google.inject.Key<T> key, com.google.inject.Provider<T> creator)
          Returns a provider that finds the instance registry corresponding to the current context and returns the object registered with the given key, creating it if it doesn't exist in the registry.
 java.lang.Class<C> type()
          The type of object used as a context identifier.
 
Methods inherited from interface com.google.inject.Scope
toString
 

Method Detail

scope

<T> com.google.inject.Provider<T> scope(com.google.inject.Key<T> key,
                                        com.google.inject.Provider<T> creator)
Returns a provider that finds the instance registry corresponding to the current context and returns the object registered with the given key, creating it if it doesn't exist in the registry.

Specified by:
scope in interface com.google.inject.Scope

get

C get()
The context identifier used to look up an instance registry. The value returned is a function of the current context.

Specified by:
get in interface com.google.inject.Provider<C>

type

java.lang.Class<C> type()
The type of object used as a context identifier.


getKeysInScope

java.util.List<com.google.inject.Key<?>> getKeysInScope()
The keys bound in this scope.


getOpenContexts

java.util.Collection<C> getOpenContexts()
The context identifiers of all open contexts that this scope knows about.


close

void close(C context,
           ContextCloseHandler<?>... closeHandlers)
Closes the given context.


closeAll

void closeAll(ContextCloseHandler<?>... closeHandlers)
Closes all open contexts.


Copyright 2008