Class AnnotationResolver


  • public class AnnotationResolver
    extends java.lang.Object
    Annotation resolver that resolves annotation in a matter similar to JAX-RS/Jakarta REST definitions.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isAnnotationPresent​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass, java.lang.reflect.Method method)
      Returns whether or not the queried annotation is present on the method.
      static <T extends java.lang.annotation.Annotation>
      T
      resolveAnnotation​(java.lang.Class<T> annotationClass, java.lang.reflect.Method method)
      Finds the annotation on the method with the following criteria: 1.
      • Methods inherited from class java.lang.Object

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

      • AnnotationResolver

        public AnnotationResolver()
    • Method Detail

      • resolveAnnotation

        public static <T extends java.lang.annotation.Annotation> T resolveAnnotation​(java.lang.Class<T> annotationClass,
                                                                                      java.lang.reflect.Method method)
        Finds the annotation on the method with the following criteria: 1. Find the annotation on method directly. If not present, 2. Find the annotation on the same method in the superclass (superclass hierarchy). If not present, 3. Find the annotation on the same method in the implemented interfaces (and interfaces implemented by its superclasses). If not found return null.
        Type Parameters:
        T - the actual type of the annotation
        Parameters:
        annotationClass - annotation to look for
        method - method to scan
        Returns:
        the found annotation object or null if not found
      • isAnnotationPresent

        public static boolean isAnnotationPresent​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass,
                                                  java.lang.reflect.Method method)
        Returns whether or not the queried annotation is present on the method.
        Returns:
        true if the annotation is found, false otherwise
        See Also:
        resolveAnnotation(java.lang.Class<T>, java.lang.reflect.Method)