Details

    • Type: Feature Request
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.Final
    • Fix Version/s: None
    • Component/s: Beans
    • Labels:
      None

      Description

      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 this 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:

      @SuppressWarnings("unchecked")
      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);
      
          ....
      
      }
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                chrisjr Chris Rankin
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: