Class ReflectionHelper


  • public class ReflectionHelper
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static boolean acceptsStringArray​(java.lang.reflect.Method method)  
      static java.lang.reflect.Method[] excludingMain​(java.lang.Class<?> clazz)  
      static <T extends java.lang.annotation.Annotation>
      T
      findAnnotation​(java.lang.Class<?> typedTestClass, java.lang.Class<T> annotation)
      A helper method that looks for a given annotation in the current class (or) in any of the super classes
      private static java.util.Set<java.lang.Class<?>> getAllInterfaces​(java.lang.Class<?> clazz)  
      private static java.util.List<java.lang.reflect.Method> getDefaultMethods​(java.lang.Class<?> clazz)  
      static java.lang.reflect.Method[] getLocalMethods​(java.lang.Class<?> clazz)  
      private static boolean isStaticVoid​(java.lang.reflect.Method method)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReflectionHelper

        public ReflectionHelper()
    • Method Detail

      • getLocalMethods

        public static java.lang.reflect.Method[] getLocalMethods​(java.lang.Class<?> clazz)
        Returns:
        An array of all locally declared methods or equivalent thereof (such as default methods on Java 8 based interfaces that the given class implements).
      • excludingMain

        public static java.lang.reflect.Method[] excludingMain​(java.lang.Class<?> clazz)
        Returns:
        An array of all locally declared methods or equivalent thereof (such as default methods on Java 8 based interfaces that the given class implements) but excludes the main() method alone.
      • findAnnotation

        public static <T extends java.lang.annotation.Annotation> T findAnnotation​(java.lang.Class<?> typedTestClass,
                                                                                   java.lang.Class<T> annotation)
        A helper method that looks for a given annotation in the current class (or) in any of the super classes
        Type Parameters:
        T - - The annotation type
        Parameters:
        typedTestClass - - The class to search for
        annotation - - The annotation to look for
        Returns:
        - Either the annotation if found (or) null.
      • isStaticVoid

        private static boolean isStaticVoid​(java.lang.reflect.Method method)
      • acceptsStringArray

        private static boolean acceptsStringArray​(java.lang.reflect.Method method)
      • getDefaultMethods

        private static java.util.List<java.lang.reflect.Method> getDefaultMethods​(java.lang.Class<?> clazz)
      • getAllInterfaces

        private static java.util.Set<java.lang.Class<?>> getAllInterfaces​(java.lang.Class<?> clazz)