Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split out a bean deployer environment
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@2145 1c488680-804c-0410-94cd-c6b725194a0e
- Loading branch information
Showing
3 changed files
with
130 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package org.jboss.webbeans.bootstrap; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.Map.Entry; | ||
|
||
import org.jboss.webbeans.bean.RIBean; | ||
import org.jboss.webbeans.event.ObserverImpl; | ||
import org.jboss.webbeans.injection.resolution.ResolvableAnnotatedClass; | ||
import org.jboss.webbeans.introspector.AnnotatedItem; | ||
|
||
public class BeanDeployerEnvironment | ||
{ | ||
|
||
private static final AnnotatedItem<?, ?> OTHER_BEANS_ANNOTATED_ITEM = ResolvableAnnotatedClass.of(BeanDeployerEnvironment.class, new Annotation[0]); | ||
|
||
private final Map<AnnotatedItem<?, ?>, Set<RIBean<?>>> beanMap; | ||
private final Set<ObserverImpl<?>> observers; | ||
|
||
public BeanDeployerEnvironment() | ||
{ | ||
this.beanMap = new HashMap<AnnotatedItem<?,?>, Set<RIBean<?>>>(); | ||
this.observers = new HashSet<ObserverImpl<?>>(); | ||
} | ||
|
||
public Map<AnnotatedItem<?, ?>, Set<RIBean<?>>> getBeanMap() | ||
{ | ||
return beanMap; | ||
} | ||
|
||
public void addBean(AnnotatedItem<?, ?> key, RIBean<?> value) | ||
{ | ||
if (key == null) | ||
{ | ||
key = OTHER_BEANS_ANNOTATED_ITEM; | ||
} | ||
if (!beanMap.containsKey(key)) | ||
{ | ||
beanMap.put(key, new HashSet<RIBean<?>>()); | ||
} | ||
beanMap.get(key).add(value); | ||
} | ||
|
||
public Set<RIBean<?>> getBeans() | ||
{ | ||
Set<RIBean<?>> beans = new HashSet<RIBean<?>>(); | ||
for (Entry<AnnotatedItem<?, ?>, Set<RIBean<?>>> entry : beanMap.entrySet()) | ||
{ | ||
beans.addAll(entry.getValue()); | ||
} | ||
return beans; | ||
} | ||
|
||
public Set<ObserverImpl<?>> getObservers() | ||
{ | ||
return observers; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters