code: public static Set<Annotation> getAllAnnotations(Class<?> clazz) {
          Set<Annotation> annotationSet = new LinkedHashSet<Annotation>();
          List<Class<?>> annotationTypes = new ArrayList<Class<?>>();
  
          // Iterate through all super types of the given class
          for (Class<?> type : ReflectionUtils.getSuperTypes(clazz)) {
              Annotation[] annotations = type.getAnnotations();
  
              // Iterate through all annotations of the current class
              for (Annotation a : annotations) {
                  // Add the current annotation to the result and to the annotation types that needed to be examained for stereotype annotations
                  annotationSet.add(a);
                  annotationTypes.add(a.annotationType());
              }
          }
  
          if (stereotypeAnnotationClass != null) {
              while (!annotationTypes.isEmpty()) {
                  Class<?> annotationType = annotationTypes.remove(annotationTypes.size() - 1);
  
                  if (annotationType.isAnnotationPresent(stereotypeAnnotationClass)) {
                      // If the stereotype annotation is present examine the 'inherited' annotations
                      for (Annotation annotation : annotationType.getAnnotations()) {
                          // add the 'inherited' annotations to be examined for further stereotype annotations
                          annotationTypes.add(annotation.annotationType());
  
                          if (!annotation.annotationType().equals(stereotypeAnnotationClass)) {
                              // add the stereotyped annotations to the set
                              annotationSet.add(annotation);
                          }
                      }
                  }
              }
          }
  
          return annotationSet;
      }
docs: Returns all annotations of a class, also the annotations of the super
  classes, implemented interfaces and the annotations that are present in
  stereotype annotations. The stereotype annotation will not be included in
  the annotation set.
  <p>
  Note that the set can contain annotation objects of the same type with
  different values for their members.
  
  @param clazz the class from which to get the annotations
  @return all annotations that are present for the given class