Skip to content

Commit

Permalink
javadoc
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@319 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
pmuir committed Nov 18, 2008
1 parent d537e59 commit ac420f6
Showing 1 changed file with 28 additions and 0 deletions.
Expand Up @@ -8,15 +8,32 @@
import javax.webbeans.manager.Context;
import javax.webbeans.manager.Manager;

/**
* Base for the Context implementations
*
* @author Nicklas Karlsson
* @author Pete Muir
*
*/
public abstract class AbstractContext implements Context
{

private Class<? extends Annotation> scopeType;

public AbstractContext(Class<? extends Annotation> scopeType)
{
this.scopeType = scopeType;
}

/**
* Get the bean if it exists in the contexts.
*
* @param create If true, a new instance of the bean will be created if none
* exists
*
* @throws ContextNotActiveException if the context is not active
*
*/
public <T> T get(Bean<T> bean, boolean create)
{
if (!isActive())
Expand All @@ -39,25 +56,36 @@ public <T> T get(Bean<T> bean, boolean create)
return instance;
}

/**
* Get the scope the context is for
*/
public Class<? extends Annotation> getScopeType()
{
return scopeType;
}

/**
* Return true if the context is active
*/
public boolean isActive()
{
return getActive().get();
}

/**
* Set the context active, internal API for WBRI
*/
public void setActive(boolean active) {
getActive().set(active);
}

// TODO Do we need this
private <T> void destroy(Manager manager, Bean<T> bean)
{
bean.destroy(getBeanMap().get(bean));
}

// TODO Do we need this
public void destroy(Manager manager)
{
for (Bean<? extends Object> bean : getBeanMap().keySet())
Expand Down

0 comments on commit ac420f6

Please sign in to comment.