public class RequestContext extends Context implements RemovalCallback
itemByClass, itemByName| Modifier and Type | Method and Description |
|---|---|
static <T> T |
C(Class<T> c)
For convenience, equivalent to RequestContext.getCurrent().get(c)
This method assumes that the requested class is required and will throw
an exception if it is not found
|
static <T> T |
C(Class<T> c,
boolean required)
For convenience, equivalent to RequestContext.getCurrent().get(c)
Returns the object in context of the given type or null if not found and
required is false.
|
static RequestContext |
getCurrent() |
static RequestContext |
getInstance(RootContext parent) |
protected Registration |
getOrCreateRegistration(Class c,
Context context)
If creating, the item is inserted into the given context
Should only be used when a child is referring to a parent, so that
the
|
protected Registration |
getRegistration(Class c) |
protected Registration |
getRegistration(String id) |
RootContext |
getRootContext() |
void |
onRemove(Object item)
Called when this request context goes out of context.
|
static RequestContext |
peekInstance() |
public static <T> T C(Class<T> c) throws ClassNotInContextException
T - - the type expected to be returnedc - - the class toClassNotInContextExceptionpublic static <T> T C(Class<T> c, boolean required) throws ClassNotInContextException
T - c - required - - if true will throw an exception if the requested class
is not found. Otherwise will return null.ClassNotInContextExceptionpublic static RequestContext getCurrent()
public static RequestContext getInstance(RootContext parent)
public static RequestContext peekInstance()
public RootContext getRootContext()
protected Registration getRegistration(Class c)
getRegistration in class Contextprotected Registration getRegistration(String id)
getRegistration in class Contextprotected Registration getOrCreateRegistration(Class c, Context context)
Contextpublic void onRemove(Object item)
onRemove in interface RemovalCallback