Class ReflectionUtils

java.lang.Object
net.engio.mbassy.common.ReflectionUtils

public class ReflectionUtils extends Object
  • Constructor Details

    • ReflectionUtils

      public ReflectionUtils()
  • Method Details

    • getMethods

      public static Method[] getMethods(IPredicate<Method> condition, Class<?> target)
    • getMethods

      public static void getMethods(IPredicate<Method> condition, Class<?> target, ArrayList<Method> methods)
    • getOverridingMethod

      public 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 exists
      Parameters:
      overridingMethod -
      subclass -
    • getSuperTypes

      public static Class[] getSuperTypes(Class from)
      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

      public static void collectInterfaces(Class from, Collection<Class> accumulator)
    • containsOverridingMethod

      public static boolean containsOverridingMethod(Method[] allMethods, Method methodToCheck)
    • 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

      private static boolean isOverriddenBy(Method superclassMethod, Method subclassMethod)