/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public <T extends Annotation> Loadable<T> prepare(Class<T> annotationType) { if (!annotation.annotationType().getName().equals(annotationType.getName())) { throw new IllegalArgumentException(annotationType + " does not represent " + annotation.annotationType()); } return annotationType == annotation.annotationType() ? (Loadable<T>) this : new ForLoadedAnnotation<T>((T) annotation, annotationType); }
/** * Returns a builder with the additional annotation property. * * @param property The name of the property to define. * @param annotation The annotation value to define. * @return A builder with the additional annotation property. */ public Builder define(String property, Annotation annotation) { return define(property, new ForLoadedAnnotation<Annotation>(annotation)); }
/** * Creates a description of the given annotation. * * @param annotation The annotation to be described. * @param <U> The type of the annotation. * @return A description of the given annotation. */ public static <U extends Annotation> Loadable<U> of(U annotation) { return new ForLoadedAnnotation<U>(annotation); }