/** * Ignores the classes which are manually added using bindings (through {@link Application} class) and scanned by CDI. * The manual adding is privileged and the beans scanned using CDI are ignored. * <p> * TODO: The method counts with the condition that the all bindings are known before the CDI scanning has been started, * can be changed during the migration from CDI SE to JAVA EE environment. * * @param pat processed type. * @param <T> type of the scanned bean. */ public <T> void ignoreManuallyRegisteredComponents( @Observes @WithAnnotations({ Path.class, Provider.class }) ProcessAnnotatedType<T> pat) { for (Binding binding : bindings.getBindings()) { if (ClassBinding.class.isAssignableFrom(binding.getClass())) { ClassBinding<?> classBinding = (ClassBinding<?>) binding; if (pat.getAnnotatedType().getJavaClass() == classBinding.getService()) { pat.veto(); return; } } else if (InstanceBinding.class.isAssignableFrom(binding.getClass())) { InstanceBinding<?> instanceBinding = (InstanceBinding<?>) binding; if (pat.getAnnotatedType().getJavaClass() == instanceBinding.getService().getClass()) { pat.veto(); return; } } } }
final Type baseType = annotatedType.getBaseType(); if (customHk2TypesProvider.getHk2Types().contains(baseType)) { processAnnotatedType.veto(); jerseyVetoedTypes.add(baseType);
public void registerClient(@Observes @WithAnnotations({RegisterRestClient.class}) ProcessAnnotatedType<?> pat) { Class<?> typeDef = pat.getAnnotatedType().getJavaClass(); if(typeDef.isInterface()) { proxyTypes.add(typeDef); pat.veto(); } else { errors.add(new IllegalArgumentException("Rest client needs to be interface: " + typeDef)); } }
@Override public void veto() { pat.veto(); } });
protected void vetoScannedCDIJCacheHelperQualifiers(final @Observes ProcessAnnotatedType<CDIJCacheHelper> pat) { if (!needHelper) { // already seen, shouldn't really happen,just a protection pat.veto(); } needHelper = false; }
protected void vetoScannedCDIJCacheHelperQualifiers(final @Observes ProcessAnnotatedType<CDIJCacheHelper> pat) { if (SKIP) { return; } if (!needHelper) { // already seen, shouldn't really happen,just a protection pat.veto(); } needHelper = false; }
<X> void processAnnotatedType(@Observes final javax.enterprise.inject.spi.ProcessAnnotatedType<X> pat, BeanManager beanManager) { if (isHttpRequestSupportAvailable) { final AnnotatedType<X> annotatedType = pat.getAnnotatedType(); final Class<X> javaClass = annotatedType.getJavaClass(); if (javaClass != null && javaClass.getName().equals(HttpRequestProducer.class.getName())) { pat.veto(); } } return; } }
private void vetoBean(ProcessAnnotatedType processAnnotatedType) { if(this.logger.isLoggable(Level.FINER)) { this.logger.finer(processAnnotatedType.getAnnotatedType().getJavaClass().getName() + " won't be used as CDI bean"); } processAnnotatedType.veto(); }
protected void vetoCustomProjectStageBeans(ProcessAnnotatedType processAnnotatedType) { //currently there is a veto for all project-stage implementations, //but we still need @Typed() for the provided implementations in case of the deactivation of this behaviour if (ProjectStage.class.isAssignableFrom(processAnnotatedType.getAnnotatedType().getJavaClass())) { processAnnotatedType.veto(); } }
public void findClients(@Observes @WithAnnotations({RegisterRestClient.class}) ProcessAnnotatedType<?> pat) { Class<?> restClient = pat.getAnnotatedType().getJavaClass(); if (restClient.isInterface()) { restClientClasses.add(restClient); pat.veto(); } else { errors.add(new IllegalArgumentException("The class " + restClient + " is not an interface")); } }
public void findClients(@Observes @WithAnnotations({RegisterRestClient.class}) ProcessAnnotatedType<?> pat) { Class<?> restClient = pat.getAnnotatedType().getJavaClass(); if (restClient.isInterface()) { restClientClasses.add(restClient); pat.veto(); } else { errors.add(new IllegalArgumentException("The class " + restClient + " is not an interface")); } }
public void skipTracerBeans(@Observes ProcessAnnotatedType<? extends Tracer> processAnnotatedType) { TracingLogger.ROOT_LOGGER.extraTracerBean(processAnnotatedType.getAnnotatedType().getJavaClass().getName()); processAnnotatedType.veto(); } }
void processAnnotatedType(@Observes ProcessAnnotatedType<?> event) { if (vetoAnnotatedTypePattern.matcher(event.getAnnotatedType().getJavaClass().getName()).matches() && !AnnotatedTypes.hasBeanDefiningAnnotation(event.getAnnotatedType())) { // Logging is not necessary - see BootstrapLogger.annotatedTypeVetoed(Object, Object) event.veto(); } }
void processAnnotatedType(@Observes ProcessAnnotatedType<?> event) { if (vetoAnnotatedTypePattern.matcher(event.getAnnotatedType().getJavaClass().getName()).matches() && !AnnotatedTypes.hasBeanDefiningAnnotation(event.getAnnotatedType())) { // Logging is not necessary - see BootstrapLogger.annotatedTypeVetoed(Object, Object) event.veto(); } }
void processAnnotatedType(@Observes ProcessAnnotatedType<?> event) { if (vetoAnnotatedTypePattern.matcher(event.getAnnotatedType().getJavaClass().getName()).matches() && !AnnotatedTypes.hasBeanDefiningAnnotation(event.getAnnotatedType())) { // Logging is not necessary - see BootstrapLogger.annotatedTypeVetoed(Object, Object) event.veto(); } }
void processAnnotatedType(@Observes ProcessAnnotatedType<?> event) { if (vetoAnnotatedTypePattern.matcher(event.getAnnotatedType().getJavaClass().getName()).matches() && !AnnotatedTypes.hasBeanDefiningAnnotation(event.getAnnotatedType())) { // Logging is not necessary - see BootstrapLogger.annotatedTypeVetoed(Object, Object) event.veto(); } }
private void checkExpressionActivated(ProcessAnnotatedType<?> processAnnotatedType) { Class<?> annotatedClass = processAnnotatedType.getAnnotatedType().getJavaClass(); if(!ActivationUtils.isActivated(annotatedClass, PropertyExpressionInterpreter.class)) { processAnnotatedType.veto(); LOG.finer("Expression Veto for bean with type: " + processAnnotatedType.getAnnotatedType().getJavaClass() ); } }
public void processGenericBeanAnnotated(@Observes ProcessAnnotatedType<?> pat) { AnnotatedType<?> at = pat.getAnnotatedType(); if (at.isAnnotationPresent(Generic.class) && !(at.isAnnotationPresent(OAuth.class))) { genericClasses.add(at.getJavaClass()); pat.veto(); } }
@Test public void testStandaloneAnnotationWithStandaloneController() { System.setProperty(ControllerUtils.KIE_SERVER_CONTROLLER, "http://localhost:8080/controller"); final ProcessAnnotatedType annotatedType = createAnnotatedType(KieServerStandaloneControllerProducer.class); extension.processStandaloneController(annotatedType); verify(annotatedType, never()).veto(); }
@Test public void testStandaloneAnnotationWithEmbeddedController() { final ProcessAnnotatedType annotatedType = createAnnotatedType(KieServerStandaloneControllerProducer.class); extension.processStandaloneController(annotatedType); verify(annotatedType).veto(); }