[cdi-dev] [JBoss JIRA] (CDI-551) Easier access to InjectionPoint qualifiers.

Chris Rankin (JIRA) issues at jboss.org
Fri Jul 24 04:11:06 EDT 2015

Chris Rankin created CDI-551:

             Summary: Easier access to InjectionPoint qualifiers.
                 Key: CDI-551
                 URL: https://issues.jboss.org/browse/CDI-551
             Project: CDI Specification Issues
          Issue Type: Feature Request
          Components: Beans
    Affects Versions: 1.2.Final
            Reporter: Chris Rankin

I would like to extend {{javax.enterprise.inject.spi.InjectionPoint}} for easier analysis of both static and dynamic qualifiers.

I have previously used {{InjectionPoint.getAnnotated()}}, but have now realised that is not enough because it cannot include {{AnnotationLiteral}} qualifiers added via {{Instance.select(...)}}. The only reliable way to analyse _all_ of the qualifiers is currently via {{InjectionPoint.getQualifiers()}}, which unfortunately returns {{Set<Annotated>}}.

A {{Set<Annotated>>}} is not immediately useful to me; about the only thing that I can do with it is iterate over it every time. So I must convert it into something more like this first:

public class QualifierMap extends HashMap<Class<? extends Annotation>, Annotation> {
    private static final long serialVersionUID = 1L;

    public QualifierMap(Iterable<? extends Annotation> qualifiers) {
        for (Annotation qualifier : qualifiers) {
            put(qualifier.annotationType(), qualifier);

    public <T extends Annotation> T get(Class<T> key) {
        return (T) super.get(key);


However, it would be much _more_ convenient if {{InjectionPoint}} could export this functionality automatically instead:

public interface InjectionPoint {


    boolean isQualifierPresent(Class<? extends Annotation> annotationType);  
    <T extends Annotation> T getQualifier(Class<T> annotationType);



This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list