All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.resteasy.util.AnnotationResolver Maven / Gradle / Ivy

The newest version!
package org.jboss.resteasy.util;

import java.lang.annotation.Annotation;

public class AnnotationResolver
{
   @SuppressWarnings(value = "unchecked")
   public static Class getClassWithAnnotation(Class clazz, Class annotation)
   {
      if (clazz.isAnnotationPresent(annotation))
      {
         return clazz;
      }
      for (Class intf : clazz.getInterfaces())
      {
         if (intf.isAnnotationPresent(annotation))
         {
            return intf;
         }
      }
      Class superClass = clazz.getSuperclass();
      if (superClass != Object.class && superClass != null)
      {
         return getClassWithAnnotation(superClass, annotation);
      }
      return null;

   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy