diff --git a/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractContext.java b/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractContext.java index b887681ba71..b58ab56e231 100644 --- a/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractContext.java +++ b/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractContext.java @@ -8,8 +8,16 @@ 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 scopeType; public AbstractContext(Class scopeType) @@ -17,6 +25,15 @@ public AbstractContext(Class 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 get(Bean bean, boolean create) { if (!isActive()) @@ -39,25 +56,36 @@ public T get(Bean bean, boolean create) return instance; } + /** + * Get the scope the context is for + */ public Class 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 void destroy(Manager manager, Bean bean) { bean.destroy(getBeanMap().get(bean)); } + // TODO Do we need this public void destroy(Manager manager) { for (Bean bean : getBeanMap().keySet())