Class ReflectionUtil

java.lang.Object
es.urjc.etsii.grafo.util.ReflectionUtil

public class ReflectionUtil extends Object
  • Constructor Details

    • ReflectionUtil

      public ReflectionUtil()
  • Method Details

    • findTypesByAnnotation

      public static <T> List<Class<T>> findTypesByAnnotation(String packageName, Class<? extends Annotation> clazz)
    • findTypesBySuper

      public static <T> List<Class<T>> findTypesBySuper(String packageName, Class<T> clazz)
    • findTypesByFilter

      public static <T> List<Class<T>> findTypesByFilter(String packageName, org.springframework.core.type.filter.TypeFilter filter)
    • isObjectClass

      public static boolean isObjectClass(Class<?> clazz)
      Check if the given class is equivalent to Object.class
      Parameters:
      clazz - class to test
      Returns:
      true if the given class is a reference to the Object class, false otherwise
    • hierarchyContainsAny

      public static boolean hierarchyContainsAny(Class<?> clazz, Set<Class<?>> set)
      Check if the given class or any of the classes it extends, or the interfaces it implements, is contained in the set Example: hierarchyContainsAny(ArrayList.class, Set.of(List.class)) would return true.
      Parameters:
      clazz - class to test
      set - set of reference classes
      Returns:
      return true if the class extends any class in the set, or is directly in the set, false otherwise