public class ReflectionUtils extends Object
| Constructor and Description |
|---|
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Class<?> |
getClass(String clazzName) |
static Stream<String> |
getTopLevelClassesInClasspath(Class<?> clazz)
Scans all classes accessible from the context class loader
which belong to the given package and subpackages.
|
static boolean |
hasConstructor(String clazz,
Class<?>[] constructorArgTypes)
Check if the clazz has the target constructor or not.
|
static boolean |
isSameClass(Comparable<?> v,
Comparable<?> o)
Returns whether the given two comparable values come from the same runtime class.
|
static <T> T |
loadClass(String className) |
static Object |
loadClass(String clazz,
Class<?>[] constructorArgTypes,
Object... constructorArgs)
Creates an instance of the given class.
|
static Object |
loadClass(String clazz,
Object... constructorArgs)
Creates an instance of the given class.
|
static <T extends HoodieRecordPayload> |
loadPayload(String recordPayloadClass,
Object[] payloadArgs,
Class<?>... constructorArgTypes)
Instantiate a given class with a generic record payload.
|
public static <T> T loadClass(String className)
public static <T extends HoodieRecordPayload> T loadPayload(String recordPayloadClass, Object[] payloadArgs, Class<?>... constructorArgTypes)
public static Object loadClass(String clazz, Class<?>[] constructorArgTypes, Object... constructorArgs)
public static boolean hasConstructor(String clazz, Class<?>[] constructorArgTypes)
HoodieException from loadClass(java.lang.String), it's inconvenient to say if the exception was thrown
due to the instantiation's own logic or missing constructor.
TODO: ReflectionUtils should throw a specific exception to indicate Reflection problem.public static Object loadClass(String clazz, Object... constructorArgs)
public static Stream<String> getTopLevelClassesInClasspath(Class<?> clazz)
clazz - classpublic static boolean isSameClass(Comparable<?> v, Comparable<?> o)
Copyright © 2022 The Apache Software Foundation. All rights reserved.