code: protected static <A> A getAnnotation(Class<A> annotationClass, Class endpointClass) {
          if (endpointClass == Object.class || endpointClass == null) return null;
          A annotation = _getAnnotation(annotationClass, endpointClass);
          if (annotation == null) {
              Class sCls = endpointClass.getSuperclass();
              if (sCls != null) {
                  annotation = _getAnnotation(annotationClass, sCls);
              }
  
              if (annotation == null) {
                  Class[] inces = endpointClass.getInterfaces();
                  for (Class infc : inces) {
                      annotation = _getAnnotation(annotationClass, infc);
                      if (annotation != null) {
                          return annotation;
                      }
                  }
                  annotation = getAnnotation(annotationClass, sCls);
                  if (annotation == null) {
                      for (Class infc : inces) {
                          annotation = getAnnotation(annotationClass, infc);
                          if (annotation != null) {
                              return annotation;
                          }
                      }
                  }
              }
          }
          return annotation;
      }
docs: <p>getAnnotation.</p>
  
  @param annotationClass a {@link java.lang.Class} object.
  @param endpointClass   a {@link java.lang.Class} object.
  @param <A>             a A object.
  @return a A object.