private void processInjectionPoints(@Observes ProcessInjectionPoint<?, ?> pip) { Type type = pip.getInjectionPoint().getType(); if (type.equals(Counter.class) || type.equals(Histogram.class) || type.equals(Meter.class) || type.equals(Timer.class)) { pip.configureInjectionPoint().addQualifier(VendorDefined.Literal.INSTANCE); } }
private void processInjectionPoints(@Observes ProcessInjectionPoint<?, ?> pip) { Type type = pip.getInjectionPoint().getType(); if (type.equals(Counter.class) || type.equals(Histogram.class) || type.equals(Meter.class) || type.equals(Timer.class)) { pip.configureInjectionPoint().addQualifier(VendorDefined.Literal.INSTANCE); } }
void observesAirPlanePIP(@Observes ProcessInjectionPoint<AirPlane, Tank> event) { // change type of constructor param IP and add @Flying qualifier event.configureInjectionPoint() .type(Engine.class) .addQualifier(Flying.FlyingLiteral.INSTANCE); }
void observePIP(@Observes ProcessInjectionPoint<Warehouse, Box> event) { event.configureInjectionPoint().addQualifier(Any.Literal.INSTANCE); final InjectionPoint delegate = event.getInjectionPoint(); try { event.setInjectionPoint(new ForwardingInjectionPoint() { @Override protected InjectionPoint delegate() { return delegate; } @Override public boolean isTransient() { return true; } @Override public Type getType() { return Box.class; } @Override public Set<Annotation> getQualifiers() { return Collections.unmodifiableSet(new HashSet<Annotation>(Arrays.asList(Any.Literal.INSTANCE))); } }); } catch (IllegalStateException e) { // expected should blow up with ISE PIP_ISE_CAUGHT = true; } }