Class ClassUtils

java.lang.Object
org.postgresql.util.ClassUtils

public final class ClassUtils extends Object
Utility class for safe class loading operations.
  • 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 load
      expectedClass - the expected superclass or interface
      classLoader - the class loader to use
      Returns:
      the loaded class as a subclass of the expected type
      Throws:
      ClassNotFoundException - if the class cannot be found