*/
public Context getContext(Class<? extends Annotation> scopeType)
{
Asserts.assertNotNull(scopeType, "scopeType paramter can not be null");
Context standardContext = webBeansContext.getContextFactory().getStandardContext(scopeType);
if(standardContext != null && standardContext.isActive())
{
return standardContext;
}
// this is by far the most case
Context singleContext = singleContextMap.get(scopeType);
if (singleContext != null)
{
if (!singleContext.isActive())
{
throw new ContextNotActiveException("WebBeans context with scope type annotation @"
+ scopeType.getSimpleName()
+ " does not exist within current thread");
}
return singleContext;
}
// the spec also allows for multiple contexts existing for the same scope type
// but in this case only one must be active at a time (for the current thread)
List<Context> others = contextMap.get(scopeType);
Context found = null;
if(others != null)
{
for(Context otherContext : others)
{