|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Context
Provides an operation for obtaining contextual instances with a particular scope
of any contextual type. Any instance of Context
is called a context object.
The context object is responsible for creating and destroying contextual instances
by calling operations of Contextual
. In particular,
the context object is responsible for destroying any contextual instance it creates by
passing the instance to
Contextual.destroy(Object, CreationalContext)
. A
destroyed instance must not subsequently be returned by get()
.
The context object must pass the same instance of
CreationalContext
to Contextual.destroy()
that it passed to Contextual.create()
when it created the instance.
A custom context object may be registered with the container using
AfterBeanDiscovery.addContext(Context)
.
Method Summary | ||
---|---|---|
|
get(Contextual<T> contextual)
Return an existing instance of a certain contextual type or a null value. |
|
|
get(Contextual<T> contextual,
CreationalContext<T> creationalContext)
Return an existing instance of certain contextual type or create a new instance by calling Contextual.create(CreationalContext)
and return the new instance. |
|
java.lang.Class<? extends java.lang.annotation.Annotation> |
getScope()
Get the scope type of the context object. |
|
boolean |
isActive()
Determines if the context object is active. |
Method Detail |
---|
java.lang.Class<? extends java.lang.annotation.Annotation> getScope()
<T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
Contextual.create(CreationalContext)
and return the new instance.
T
- the type of contextual typecontextual
- the contextual typecreationalContext
- the context in which the new instance will be created
ContextNotActiveException
- if the context is not active<T> T get(Contextual<T> contextual)
T
- the type of the contextual typecontextual
- the contextual type
ContextNotActiveException
- if the context is not activeboolean isActive()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2009, 2010, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.
Generated on 4-June-2010 04:34