Package org.postgresql.util
Class ClassUtils
java.lang.Object
org.postgresql.util.ClassUtils
Utility class for safe class loading operations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Class<? extends T> forName(String className, Class<T> expectedClass, 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 Details
-
forName
public static <T> Class<? extends T> forName(String className, Class<T> expectedClass, ClassLoader classLoader) throws ClassNotFoundException Safely 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:
ClassNotFoundException- if the class cannot be found
-