Uploaded image for project: 'CDI Specification Issues'
  1. CDI Specification Issues
  2. CDI-471

Support repeating qualifiers

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 2.0 .Final
    • None
    • Resolution

      As Java 8 provides improved support for repeating annotations, it would be valuable to percolate that support into the CDI typesafe resolution mechanism.

      For example, one could write:

      @Qualifier
      @Repeatable(ContextNames.class)
      public interface @ContextName {
          String value;
      }
      
      public @interface ContextNames {
          ContextName[] value();
      }
      

      And then:

      @ContextName("ctx1")
      class CamelContext1 {
      }
      
      @ContextName("ctx2")
      class CamelContext2 {
      }
      
      @Uri("")
      @Produces
      @ContextName("ctx1")
      @ContextName("ctx2")
      static ProducerTemplate producerTemplate(InjectionPoint ip, @Any Instance<CamelContext> instance) {
      }
      

      That enables to use annotations both as a CDI qualifiers and a metadata providers while still be relying on standard typesafe resolution mechanism during the deployment phase to detect unsatisfied or ambiguous dependencies.

      Support of the annotation container / list for backward compatibility could be provided as well.

            meetoblivion_jira John Ament (Inactive)
            astefanu@redhat.com Antonin Stefanutti
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: