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

Could InterceptionFactory accept an interface as type parameter

    Details

    • Type: Clarification
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.0 .Final
    • Fix Version/s: 2.0 .Final
    • Component/s: None
    • Labels:
      None

      Description

      If you take this code:

          @Produces
          public List<Object> produceList(InterceptionFactory<List<Object>> interceptionFactory) {
              interceptionFactory.ignoreFinalMethods().configure().filterMethods((m) -> {
                  if (m.getJavaMember().getName().equals("add")
                          && m.getJavaMember().getParameterCount() == 1) {
                      return true;
                  }
                  return false;
              }).findFirst().get().add(Monitor.Literal.INSTANCE);
              return interceptionFactory.createInterceptedInstance(new ArrayList<>());
          }
      

      Parameterized type for injected InterceptionFactory is an interface List<Object>, so when calling configure(), user will work with an AnnotatedTypeConfigurator<List<Object>> to apply interceptor binding.

      In a standard interceptor usage, interceptor binding on interface are ignored (even if they have @Inherited annotation), so doing it with InterceptionFactory could be confusing for some user.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                antoinesabot-durand Antoine Sabot-Durand
                Reporter:
                antoinesabot-durand Antoine Sabot-Durand
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: