public AnnotationBuilder add(Annotation annotation) { if (annotation == null) { throw new IllegalArgumentException(messages.parameterMustNotBeNull("annotation")); } annotationSet.add(annotation); annotationMap.put(annotation.annotationType(), annotation); return this; }
public AnnotationBuilder remove(Class<? extends Annotation> annotationType) { if (annotationType == null) { throw new IllegalArgumentException(messages.parameterMustNotBeNull("annotationType")); } Iterator<Annotation> it = annotationSet.iterator(); while (it.hasNext()) { Annotation an = it.next(); if (annotationType.isAssignableFrom(an.annotationType())) { it.remove(); } } annotationMap.remove(annotationType); return this; }