Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract out utility method for extracting qualifiers
- Loading branch information
Showing
2 changed files
with
44 additions
and
16 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
impl/src/main/java/org/jboss/weld/extensions/bean/Beans.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,42 @@ | ||
package org.jboss.weld.extensions.bean; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import javax.enterprise.inject.spi.BeanManager; | ||
|
||
public class Beans | ||
{ | ||
|
||
private Beans() {} | ||
|
||
public static Set<Annotation> getQualifiers(Iterable<Annotation> annotations, BeanManager beanManager) | ||
{ | ||
Set<Annotation> qualifiers = new HashSet<Annotation>(); | ||
for (Annotation annotation : annotations) | ||
{ | ||
if (beanManager.isQualifier(annotation.annotationType())) | ||
{ | ||
qualifiers.add(annotation); | ||
} | ||
} | ||
return qualifiers; | ||
} | ||
|
||
public static Set<Annotation> getQualifiers(Annotation[] annotations, BeanManager beanManager) | ||
{ | ||
Set<Annotation> qualifiers = new HashSet<Annotation>(); | ||
for (Annotation annotation : annotations) | ||
{ | ||
if (beanManager.isQualifier(annotation.annotationType())) | ||
{ | ||
qualifiers.add(annotation); | ||
} | ||
} | ||
return qualifiers; | ||
} | ||
|
||
|
||
|
||
} |
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