/** * Remove an annotation from the type * * @param annotationType the annotation type to remove * @throws IllegalArgumentException if the annotationType */ public AnnotatedTypeBuilder<X> removeFromClass(Class<? extends Annotation> annotationType) { typeAnnotations.remove(annotationType); return this; }
/** * Remove an annotation from the specified constructor. * * @param constructor the constructor to add the annotation to * @param annotation the annotation to add * @throws IllegalArgumentException if the annotationType is null or if the * constructor is not currently declared on the type */ public AnnotatedTypeBuilder<X> removeFromConstructor(Constructor<X> constructor, Class<? extends Annotation> annotationType) { if (constructors.get(constructor) != null) { constructors.get(constructor).remove(annotationType); } return this; }
/** * Remove an annotation from the specified constructor parameter. * * @param method the constructor to remove the annotation from * @param position the position of the parameter to remove * @param annotationType the annotation type to remove * @throws IllegalArgumentException if the annotationType is null, if the * constructor is not currently declared on the type or if the * parameter is not declared on the constructor */ public AnnotatedTypeBuilder<X> removeFromConstructorParameter(Constructor<X> constructor, int position, Class<? extends Annotation> annotationType) { if (constructorParameters.get(constructor) != null) { if (constructorParameters.get(constructor).get(position) != null) { constructorParameters.get(constructor).get(position).remove(annotationType); } } return this; }
for (Entry<Field, AnnotationBuilder> field : fields.entrySet()) field.getValue().remove(annotationType); method.getValue().remove(annotationType); if (methodParameters.get(method.getKey()) != null) parameter.getValue().remove(annotationType); constructor.getValue().remove(annotationType); if (constructorParameters.get(constructor.getKey()) != null) parameter.getValue().remove(annotationType);
/** * Remove an annotation from the specified method. * * @param method the method to remove the annotation from * @param annotationType the annotation type to remove * @throws IllegalArgumentException if the annotationType is null or if the * method is not currently declared on the type */ public AnnotatedTypeBuilder<X> removeFromMethod(Method method, Class<? extends Annotation> annotationType) { if (methods.get(method) == null) { throw new IllegalArgumentException(messages.methodNotPresent(method, getJavaClass())); } else { methods.get(method).remove(annotationType); } return this; }
/** * Remove an annotation from the specified field. * * @param field the field to remove the annotation from * @param annotationType the annotation type to remove * @throws IllegalArgumentException if the annotationType is null or if the * field is not currently declared on the type */ public AnnotatedTypeBuilder<X> removeFromField(Field field, Class<? extends Annotation> annotationType) { if (fields.get(field) == null) { throw new IllegalArgumentException(messages.fieldNotPresent(field, getJavaClass())); } else { fields.get(field).remove(annotationType); } return this; }
/** * Remove an annotation from the specified method parameter. * * @param method the method to remove the annotation from * @param position the position of the parameter to remove * @param annotationType the annotation type to remove * @throws IllegalArgumentException if the annotationType is null, if the * method is not currently declared on the type or if the * parameter is not declared on the method */ public AnnotatedTypeBuilder<X> removeFromMethodParameter(Method method, int position, Class<? extends Annotation> annotationType) { if (methods.get(method) == null) { throw new IllegalArgumentException(messages.methodNotPresent(method, getJavaClass())); } else { if (methodParameters.get(method).get(position) == null) { throw new IllegalArgumentException(messages.parameterNotPresent(method, position, getJavaClass())); } else { methodParameters.get(method).get(position).remove(annotationType); } } return this; }
protected void mergeAnnotationsOnElement(Annotated annotated, boolean overwriteExisting, AnnotationBuilder typeAnnotations) { for (Annotation annotation : annotated.getAnnotations()) { if (typeAnnotations.getAnnotation(annotation.annotationType()) != null) { if (overwriteExisting) { typeAnnotations.remove(annotation.annotationType()); typeAnnotations.add(annotation); } } else { typeAnnotations.add(annotation); } } }
public void redefine(RedefinitionContext<Inject> ctx) { if (ctx.getAnnotatedElement() instanceof Field) { if (ctx.getAnnotatedElement().isAnnotationPresent(Generic.class)) { // This is a Generic bean injection point ctx.getAnnotationBuilder().remove(Inject.class).add(InjectGenericLiteral.INSTANCE); } } }
public void redefine(RedefinitionContext<Generic> ctx) { // if it is a parameter annotation if (!(ctx.getAnnotatedElement() instanceof AccessibleObject)) { // stick an InjectGeneric as a marker. ctx.getAnnotationBuilder().remove(Generic.class).add(InjectGenericLiteral.INSTANCE); if (ctx.getRawType().isAnnotationPresent(GenericConfiguration.class)) { ctx.getAnnotationBuilder().add(genericBeanQualifier); } } } });