Package net.engio.mbassy.common
Class ReflectionUtils
java.lang.Object
net.engio.mbassy.common.ReflectionUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
collectInterfaces
(Class from, Collection<Class> accumulator) static boolean
containsOverridingMethod
(Method[] allMethods, Method methodToCheck) static <A extends Annotation>
AgetAnnotation
(AnnotatedElement from, Class<A> annotationType) private static <A extends Annotation>
AgetAnnotation
(AnnotatedElement from, Class<A> annotationType, Set<AnnotatedElement> visited) Searches for an Annotation of the given type on the class.static Method[]
getMethods
(IPredicate<Method> condition, Class<?> target) static void
getMethods
(IPredicate<Method> condition, Class<?> target, ArrayList<Method> methods) static Method
getOverridingMethod
(Method overridingMethod, Class subclass) Traverses the class hierarchy upwards, starting at the given subclass, looking for an override of the given methods -> finds the bottom most override of the given method if any existsstatic Class[]
getSuperTypes
(Class from) Collect all directly and indirectly related super types (classes and interfaces) of a given class.private static boolean
isOverriddenBy
(Method superclassMethod, Method subclassMethod)
-
Constructor Details
-
ReflectionUtils
public ReflectionUtils()
-
-
Method Details
-
getMethods
-
getMethods
public static void getMethods(IPredicate<Method> condition, Class<?> target, ArrayList<Method> methods) -
getOverridingMethod
Traverses the class hierarchy upwards, starting at the given subclass, looking for an override of the given methods -> finds the bottom most override of the given method if any exists- Parameters:
overridingMethod
-subclass
-
-
getSuperTypes
Collect all directly and indirectly related super types (classes and interfaces) of a given class.- Parameters:
from
- The root class to start with- Returns:
- A set of classes, each representing a super type of the root class
-
collectInterfaces
-
containsOverridingMethod
-
getAnnotation
private static <A extends Annotation> A getAnnotation(AnnotatedElement from, Class<A> annotationType, Set<AnnotatedElement> visited) Searches for an Annotation of the given type on the class. Supports meta annotations.- Type Parameters:
A
- Class of annotation type- Parameters:
from
- AnnotatedElement (class, method...)annotationType
- Annotation class to look for.- Returns:
- Annotation instance or null
-
getAnnotation
public static <A extends Annotation> A getAnnotation(AnnotatedElement from, Class<A> annotationType) -
isOverriddenBy
-