Package org.postgresql.util
Class ClassUtils
- java.lang.Object
-
- org.postgresql.util.ClassUtils
-
public final class ClassUtils extends java.lang.ObjectUtility class for safe class loading operations.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> java.lang.Class<? extends T>forName(java.lang.String className, java.lang.Class<T> expectedClass, java.lang.ClassLoader classLoader)Safely loads a class using the three-parameter Class.forName with initialize=false and validates it's assignable to the expected type.
-
-
-
Method Detail
-
forName
public static <T> java.lang.Class<? extends T> forName(java.lang.String className, java.lang.Class<T> expectedClass, java.lang.ClassLoader classLoader) throws java.lang.ClassNotFoundExceptionSafely loads a class using the three-parameter Class.forName with initialize=false and validates it's assignable to the expected type.- Type Parameters:
T- the expected type- Parameters:
className- the name of the class to loadexpectedClass- the expected superclass or interfaceclassLoader- the class loader to use- Returns:
- the loaded class as a subclass of the expected type
- Throws:
java.lang.ClassNotFoundException- if the class cannot be found
-
-