@Override public boolean isAnnotationPresent(final Class<? extends Annotation> annotationType) { return ctor.isAnnotationPresent(annotationType); } };
@Override public boolean isAnnotationPresent(final Class<? extends Annotation> annotationType) { return ctor.isAnnotationPresent(annotationType); } };
@Override public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) { return ctor.isAnnotationPresent(annotationType); } };
private static boolean hasQualifierAnnotation(AnnotatedConstructor<?> ctor) { return ctor.isAnnotationPresent(Inject.class); }
@Override public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) { return constructor.isAnnotationPresent(annotationType); }
public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) { for (AnnotatedConstructor<?> constructor : type.getConstructors()) { if (constructor.getParameters().isEmpty()) { return true; } if (constructor.isAnnotationPresent(Inject.class)) { return true; } } return false; }
public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) { for (AnnotatedConstructor<?> constructor : type.getConstructors()) { if (constructor.getParameters().isEmpty()) { return true; } if (constructor.isAnnotationPresent(Inject.class)) { return true; } } return false; }
public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) { for (AnnotatedConstructor<?> constructor : type.getConstructors()) { if (constructor.getParameters().isEmpty()) { return true; } if (constructor.isAnnotationPresent(Inject.class)) { return true; } } return false; }
public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) { for (AnnotatedConstructor<?> constructor : type.getConstructors()) { if (constructor.getParameters().isEmpty()) { return true; } if (constructor.isAnnotationPresent(Inject.class)) { return true; } } return false; }
public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) { for (AnnotatedConstructor<?> constructor : type.getConstructors()) { if (constructor.getParameters().isEmpty()) { return true; } if (constructor.isAnnotationPresent(Inject.class)) { return true; } } return false; }
public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) { for (AnnotatedConstructor<?> constructor : type.getConstructors()) { if (constructor.getParameters().isEmpty()) { return true; } if (constructor.isAnnotationPresent(Inject.class)) { return true; } } return false; }
private boolean isCDIOSGiConstructor(AnnotatedConstructor<T> constructor) { if (constructor.isAnnotationPresent(Inject.class)) { for (AnnotatedParameter parameter : constructor.getParameters()) { if (parameter.isAnnotationPresent(OSGiService.class)) { return true; } } } return false; }
void observesCountrysidePAT(@Observes ProcessAnnotatedType<Countryside> event) { AnnotatedConstructorConfigurator<Countryside> annotatedConstructorConfigurator = event.configureAnnotatedType() .filterConstructors(constructor -> constructor.isAnnotationPresent(Inject.class)).findFirst().get(); //add qualifier to each constructor param annotatedConstructorConfigurator.params().forEach(annotatedParam -> annotatedParam.add(Wild.WildLiteral.INSTANCE)); }
@Test @SpecAssertion(section = PROCESS_ANNOTATED_TYPE, id = "bba") public void configuratorInitializedWithOriginalAT() { AnnotatedType<Cat> catAT = getCurrentManager().getExtension(ProcessAnnotatedTypeObserver.class).getOriginalCatAT(); assertTrue(catAT.isAnnotationPresent(RequestScoped.class)); AnnotatedConstructor<Cat> annotatedConstructor = catAT.getConstructors().stream() .filter(ac -> ac.getParameters().size() == 1 && ac.getParameters().get(0).getBaseType().equals(Feed.class)).findFirst().get(); assertTrue(annotatedConstructor.getParameters().iterator().next().isAnnotationPresent(Cats.class)); assertTrue(annotatedConstructor.isAnnotationPresent(Inject.class)); }
/** * @param classLoader to use for creating the class in * @param annotatedType the annotatedType for which a subclass will get generated * @param <T> * @return the proxy class */ public synchronized <T> Class<T> createSubClass(ClassLoader classLoader, AnnotatedType<T> annotatedType) throws ProxyGenerationException { Class<T> classToProxy = annotatedType.getJavaClass(); Class<T> clazz = tryToLoadClass(classLoader, classToProxy); if (clazz != null) { return clazz; } String proxyClassName = getSubClassName(classToProxy); List<Method> methods = ClassUtil.getNonPrivateMethods(classToProxy, true); Method[] businessMethods = methods.toArray(new Method[methods.size()]); Constructor<T> cons = null; for (AnnotatedConstructor<T> c : annotatedType.getConstructors()) { if (c.isAnnotationPresent(Inject.class)) { cons = c.getJavaMember(); break; } } clazz = createProxyClass(classLoader, proxyClassName, classToProxy, businessMethods, new Method[0], cons); return clazz; }
boolean methodHasEncodedAnnotation = constructor.isAnnotationPresent(Encoded.class); for (AnnotatedParameter<T> parameter : constructor.getParameters()) { for (Annotation annotation : parameter.getAnnotations()) {
boolean methodHasEncodedAnnotation = constructor.isAnnotationPresent(Encoded.class); for (AnnotatedParameter<T> parameter : constructor.getParameters()) { for (Annotation annotation : parameter.getAnnotations()) {
boolean methodHasEncodedAnnotation = constructor.isAnnotationPresent(Encoded.class); for (AnnotatedParameter<T> parameter : constructor.getParameters()) { for (Annotation annotation : parameter.getAnnotations()) {
private void initClassDeclaredEjbInterceptors() { Class<?>[] classDeclaredInterceptors = interceptorsApi.extractInterceptorClasses(annotatedType); boolean excludeClassLevelAroundConstructInterceptors = constructor.isAnnotationPresent(ExcludeClassInterceptors.class); if (classDeclaredInterceptors != null) { for (Class<?> clazz : classDeclaredInterceptors) { InterceptorClassMetadata<?> interceptor = reader.getPlainInterceptorMetadata(clazz); for (InterceptionType interceptionType : InterceptionType.values()) { if (excludeClassLevelAroundConstructInterceptors && interceptionType.equals(InterceptionType.AROUND_CONSTRUCT)) { /* * @ExcludeClassInterceptors suppresses @AroundConstruct interceptors defined on class level */ continue; } if (interceptor.isEligible(org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(interceptionType))) { builder.interceptGlobal(interceptionType, null, Collections.<InterceptorClassMetadata<?>>singleton(interceptor), null); } } } } }
static boolean hasAnnotation(AnnotatedType<?> type, Class<? extends Annotation> annotation) { if (type.isAnnotationPresent(annotation)) { return true; } for (AnnotatedMethod<?> method : type.getMethods()) { if (method.isAnnotationPresent(annotation)) { return true; } } for (AnnotatedConstructor<?> constructor : type.getConstructors()) { if (constructor.isAnnotationPresent(annotation)) { return true; } } for (AnnotatedField<?> field : type.getFields()) { if (field.isAnnotationPresent(annotation)) { return true; } } return false; }