Class OngoingAnnotationExtraction


  • public class OngoingAnnotationExtraction
    extends java.lang.Object
    Part of a fluent clause to extract annotation information from beans.
    See Also:
    getAnnotation(Class)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T extends java.lang.annotation.Annotation>
      java.util.Optional<T>
      getAnnotation​(java.lang.Class<T> annotationClass)
      Tries to find the given annotation for the bean in question.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getAnnotation

        public <T extends java.lang.annotation.Annotation> java.util.Optional<T> getAnnotation​(java.lang.Class<T> annotationClass)
        Tries to find the given annotation for the bean in question. The strategy (and order) in which the annotation is searched is the following:
        1. If a factory method is available for the bean, then the annotation is searched on this factory method. The usual spring annotation utils are used for this, so also the methods of super types are searched.
        2. If not factory method is available, or if the annotation could not be found on it, then the annotation is searched on the class of the bean. Also here, springs annotation utils are used, so the annotation is also searched on super types.
        Type Parameters:
        T - the type of the annotation to be searched
        Parameters:
        annotationClass - the type of the annotation to be found
        Returns:
        the annotation, if found.
        See Also:
        AnnotationUtils.findAnnotation(Class, Class), AnnotationUtils.findAnnotation(Method, Class)