Package es.urjc.etsii.grafo.util
Class ReflectionUtil
java.lang.Object
es.urjc.etsii.grafo.util.ReflectionUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindTypesByAnnotation
(String packageName, Class<? extends Annotation> clazz) findTypesByFilter
(String packageName, org.springframework.core.type.filter.TypeFilter filter) findTypesBySuper
(String packageName, Class<T> clazz) 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.static boolean
isObjectClass
(Class<?> clazz) Check if the given class is equivalent to Object.class
-
Constructor Details
-
ReflectionUtil
public ReflectionUtil()
-
-
Method Details
-
findTypesByAnnotation
public static <T> List<Class<T>> findTypesByAnnotation(String packageName, Class<? extends Annotation> clazz) -
findTypesBySuper
-
findTypesByFilter
-
isObjectClass
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
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 testset
- set of reference classes- Returns:
- return true if the class extends any class in the set, or is directly in the set, false otherwise
-