Package com.linkedin.venice.utils
Class ReflectUtils
- java.lang.Object
-
- com.linkedin.venice.utils.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 argumentsstatic <T> java.lang.Class<T>
loadClass(java.lang.String className)
Load the given class using the default constructorstatic 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.
-
-
-
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 classargTypes
- The type of each argumentargs
- 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.
-
-