javax.enterprise.context.spi
Interface Context


public interface Context

The contract between the manager and a contextual object. This interface should not be called directly by the application.

Author:
Gavin King, Pete Muir

Method Summary
<T> T
get(Contextual<T> contextual)
          Return an existing instance of a contextual type or create a new instance of a contextual type
<T> T
get(Contextual<T> contextual, CreationalContext<T> creationalContext)
          Return an existing instance of a contextual type or create a new instance of a contextual type
 java.lang.Class<? extends java.lang.annotation.Annotation> getScopeType()
          The scope which this context implements
 boolean isActive()
          The context is only active at certain points in the application lifecycle
 

Method Detail

getScopeType

java.lang.Class<? extends java.lang.annotation.Annotation> getScopeType()
The scope which this context implements

Returns:
the scope

get

<T> T get(Contextual<T> contextual,
          CreationalContext<T> creationalContext)
Return an existing instance of a contextual type or create a new instance of a contextual type

Type Parameters:
T - the type of contextual type
Parameters:
contextual - the contextual type
creationalContext - the creational context in which incompletely initialized instances may be placed
Returns:
the contextual instance, or null if no creational context is given and an instance does not exist in the context
Throws:
ContextNotActiveException - if the context is not active

get

<T> T get(Contextual<T> contextual)
Return an existing instance of a contextual type or create a new instance of a contextual type

Type Parameters:
T - the type of the contextual type
Parameters:
contextual - the contextual type
Returns:
the contextual instance, or null if an instance does not exist in the context
Throws:
ContextNotActiveException - if the context is not active

isActive

boolean isActive()
The context is only active at certain points in the application lifecycle

Returns:
true if the context is active


Copyright © 2008-2009. All Rights Reserved.