/** * Add an annotation to the specified method. If the method is not already * present, it will be added. * * @param method the method to add the annotation to * @param annotation the annotation to add * @throws IllegalArgumentException if the annotation is null */ public AnnotatedTypeBuilder<X> addToMethod(AnnotatedMethod<? super X> method, Annotation annotation) { return addToMethod(method.getJavaMember(), annotation); }
builder.addToMethod(m, new DefaultBeanInformation.Literal(qualifiers)); Synthetic syntheticQualifier = producerSyntheticProvider.get(); builder.addToMethod(m, syntheticQualifier); producerToDeclaringDefaultBean.put(syntheticQualifier, new DefaultBeanQualifiers(declaringBeanSyntheticQualifier, declaringBeanQualifiers)); producers.add(syntheticQualifier);
/** * Add an annotation to the specified method. If the method is not already * present, it will be added. * * @param method the method to add the annotation to * @param annotation the annotation to add * @throws IllegalArgumentException if the annotation is null */ public AnnotatedTypeBuilder<X> addToMethod(AnnotatedMethod<? super X> method, Annotation annotation) { return addToMethod(method.getJavaMember(), annotation); }
/** * Add an annotation to the specified method. If the method is not already * present, it will be added. * * @param method the method to add the annotation to * @param annotation the annotation to add * @throws IllegalArgumentException if the annotation is null */ public AnnotatedTypeBuilder<X> addToMethod(AnnotatedMethod<? super X> method, Annotation annotation) { return addToMethod(method.getJavaMember(), annotation); }
private <X> void copyAnnotation(final ProcessAnnotatedType<X> annotatedType, final Class<?> anInterface, final Method method, final Class<? extends Annotation> annotation) { final Annotation methodAnnotation = method.getAnnotation(annotation); final Annotation typeAnnotation = anInterface.getAnnotation(annotation); if (methodAnnotation != null || typeAnnotation != null) { AnnotatedTypeBuilder<X> builder = new AnnotatedTypeBuilder<X>().readFromType(annotatedType.getAnnotatedType()); if (typeAnnotation != null) { builder = builder.addToClass(typeAnnotation); } if (methodAnnotation != null) { builder = builder.addToMethod(getMethod(annotatedType, method.getName()), methodAnnotation); } annotatedType.setAnnotatedType(builder.create()); } }
void applyQualifier(Annotation qual, AnnotatedTypeBuilder<?> atb) { AnnotatedType<?> at = atb.create(); //do a loop on all field to replace annotation mark by CDI annotations for (AnnotatedField af : at.getFields()) if (af.isAnnotationPresent(InjectWithQualifier.class)) { atb.addToField(af, InjectLiteral.instance); atb.addToField(af, qual); } //loop on constructors to do the same for (AnnotatedConstructor ac : at.getConstructors()) { Annotation[][] pa = ac.getJavaMember().getParameterAnnotations(); //loop on args to detect marked param for (int i = 0; i < pa.length; i++) for (int j = 0; j < pa[i].length; j++) if (pa[i][j].equals(InjectWithQualifierLiteral.instance)) { atb.addToConstructor(ac, InjectLiteral.instance); atb.addToConstructorParameter(ac.getJavaMember(), i, qual); } } //loop on other methods (setters) for (AnnotatedMethod am : at.getMethods()) if (am.isAnnotationPresent(InjectWithQualifierLiteral.class)) { atb.addToMethod(am, InjectLiteral.instance); atb.addToMethod(am, qual); } }
modified = true; if (!beanNameOrName(ejb).isEmpty()) { builder.addToMethod(method, new EjbName.EjbNameLiteral(beanNameOrName(ejb))); } else { builder.addToMethod(method, DefaultLiteral.INSTANCE);
EJB ejb = method.getAnnotation(EJB.class); if (ejb != null) { builder.addToMethod(method, EJbQualifierLiteral.INSTANCE); builder.removeFromMethod(method, EJB.class); modified = true; if (!ejb.beanName().isEmpty()) { builder.addToMethod(method,new EJbNameLiteral(ejb.beanName())); } else { builder.addToMethod(method,DefaultLiteral.INSTANCE);
EJB ejb = method.getAnnotation(EJB.class); if (ejb != null) { builder.addToMethod(method, EJbQualifierLiteral.INSTANCE); builder.removeFromMethod(method, EJB.class); modified = true; if (!ejb.beanName().isEmpty()) { builder.addToMethod(method,new EJbNameLiteral(ejb.beanName())); } else { builder.addToMethod(method,DefaultLiteral.INSTANCE);
builder.addToMethod(m, INTERCEPTOR_BINDING); getMetaDataStorage().addSecuredMethod(m); break;
builder.addToMethod(m, INTERCEPTOR_BINDING); getMetaDataStorage().addSecuredMethod(m); break;