public abstract class Context extends Object implements Contextual
| Modifier and Type | Field and Description |
|---|---|
protected HashMap<Class,Registration> |
itemByClass |
protected HashMap<String,Registration> |
itemByName |
| Modifier | Constructor and Description |
|---|---|
protected |
Context()
Used by subclasses
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
get(Class<T> c) |
<T> T |
get(String id) |
protected <T> Registration<T> |
getRegistration(Class<T> c) |
protected <T> Registration<T> |
getRegistration(String id) |
int |
numItemsById() |
<T> Registration<T> |
put(String id,
T o)
Place o into context, keying by the given id
|
<T> Registration<T> |
put(String id,
T o,
Factory f)
Put the given object into context, keying only the given id
|
<T> Registration<T> |
put(T o)
Place the given object into context, keying only by its class
|
<T> Registration<T> |
put(T o,
RemovalCallback f) |
void |
tearDown() |
protected HashMap<Class,Registration> itemByClass
protected HashMap<String,Registration> itemByName
public int numItemsById()
public <T> T get(String id)
get in interface Contextualpublic <T> T get(Class<T> c)
get in interface Contextualprotected <T> Registration<T> getRegistration(Class<T> c)
protected <T> Registration<T> getRegistration(String id)
public <T> Registration<T> put(String id, T o)
T - id - o - public <T> Registration<T> put(T o)
public <T> Registration<T> put(T o, RemovalCallback f)
public <T> Registration<T> put(String id, T o, Factory f)
public void tearDown()