Class ReflectUtils


  • public class ReflectUtils
    extends java.lang.Object
    Utilities for reflection TODO This class may not be needed if we decide to proceed with Guice library for reflections and need to be discarded then
    • Constructor Summary

      Constructors 
      Constructor Description
      ReflectUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T callConstructor​(java.lang.Class<T> c, java.lang.Class<?>[] argTypes, java.lang.Object[] args)
      Call the class constructor with the given arguments
      static <T> java.lang.Class<T> loadClass​(java.lang.String className)
      Load the given class using the default constructor
      static void printClasspath()
      Print to the logs the entire classpath (one line per jar)
      static void printJarContainingBadClass​(java.lang.NoSuchMethodError e)
      Given an exception about a class that doesn't have the expected API, print to the logs which jar is that class coming from.
      • Methods inherited from class java.lang.Object

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

      • ReflectUtils

        public ReflectUtils()
    • Method Detail

      • loadClass

        public static <T> java.lang.Class<T> loadClass​(java.lang.String className)
        Load the given class using the default constructor
        Parameters:
        className - The name of the class
        Returns:
        The class object
      • callConstructor

        public static <T> T callConstructor​(java.lang.Class<T> c,
                                            java.lang.Class<?>[] argTypes,
                                            java.lang.Object[] args)
        Call the class constructor with the given arguments
        Type Parameters:
        T - Type of the class
        Parameters:
        c - The class
        argTypes - The type of each argument
        args - The arguments
        Returns:
        The constructed object
      • printClasspath

        public static void printClasspath()
        Print to the logs the entire classpath (one line per jar)
      • printJarContainingBadClass

        public static void printJarContainingBadClass​(java.lang.NoSuchMethodError e)
        Given an exception about a class that doesn't have the expected API, print to the logs which jar is that class coming from.