4 Replies Latest reply on Mar 10, 2010 8:37 AM by Ashish Dasnurkar

    programmatic lookup with dynamic producers

    wildes oliveira Newbie

      Hi, im trying to implement programmatic lookup with dynamic producers, but the injectPoint argument havent been providing information about the injectionPoint members, all injectionPoint members evaluates to null or a emptySet. Is the behaviour correct ? How to implement this programmatic lookup ?


      @Inject @Any
      private Instance<InputStream> inputStreamProducer = null;
      ...
      InputStream inputStream = inputStreamProducer.select(new InstancePropertyQualifier(resourcePath)).get();
      ...
      @Qualifier
      ...
      public @interface InstanceProperty {
          @Nonbinding public String value();
      }
      ...
      @Produces @InstanceProperty("")
      public InputStream getResourceInputSream(ServletContext servletContext, InjectionPoint injectionPoint) {
              //injectionPoint.getQualifiers(); evaluates to a emptySet
              ...
              return servletContext.getResourceAsStream(path);
      }