org.directwebremoting.guice.util
Interface ContextRegistry<C,R>

All Known Implementing Classes:
AbstractContextScope, AbstractMapContextScope, AbstractSimpleContextScope

public interface ContextRegistry<C,R>

Manages instances for a context. This class is only useful for defining new implementations of AbstractContextScope.

Author:
Tim Peierls [tim at peierls dot net]

Method Summary
<T> InstanceProvider<T>
get(R registry, com.google.inject.Key<T> key, java.lang.String keyString)
          Looks up an InstanceProvider for a key (either directly or using the precalculated key.toString() value) in a registry object, returning null if not found.
<T> InstanceProvider<T>
putIfAbsent(R registry, com.google.inject.Key<T> key, java.lang.String keyString, InstanceProvider<T> creator)
          Looks up an InstanceProvider for a key (either directly or using the precalculated key.toString() value) in a registry object, returning null if not found, otherwise returning the existing value.
 R registryFor(C context)
          Returns the registry object associated with the given context.
<T> boolean
remove(R registry, com.google.inject.Key<T> key, java.lang.String keyString, InstanceProvider<T> creator)
          Removes the registry entry for the given key (either directly or using the precalculated key.toString() value) from a registry object if the registered value is identical to creator.
 

Method Detail

registryFor

R registryFor(C context)
Returns the registry object associated with the given context.


get

<T> InstanceProvider<T> get(R registry,
                            com.google.inject.Key<T> key,
                            java.lang.String keyString)
Looks up an InstanceProvider for a key (either directly or using the precalculated key.toString() value) in a registry object, returning null if not found.


putIfAbsent

<T> InstanceProvider<T> putIfAbsent(R registry,
                                    com.google.inject.Key<T> key,
                                    java.lang.String keyString,
                                    InstanceProvider<T> creator)
Looks up an InstanceProvider for a key (either directly or using the precalculated key.toString() value) in a registry object, returning null if not found, otherwise returning the existing value.


remove

<T> boolean remove(R registry,
                   com.google.inject.Key<T> key,
                   java.lang.String keyString,
                   InstanceProvider<T> creator)
Removes the registry entry for the given key (either directly or using the precalculated key.toString() value) from a registry object if the registered value is identical to creator.

Returns:
whether the value was removed

Copyright 2008