Class ClassLoading


  • public class ClassLoading
    extends Object
    Version:
    $Id: ClassLoading.java 34360 2009-07-22 23:58:59Z tolusha $
    Author:
    Anatoliy Bazko
    • Constructor Summary

      Constructors 
      Constructor Description
      ClassLoading()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Class<?> forName​(String type, Class<?> callerClass)
      Loads the class using the ClassLoader corresponding to the caller class first, if class not found we try with Thread's context ClassLoader (TCCL).
      static Class<?> forName​(String type, Object callerObject)
      Loads the class using the ClassLoader corresponding to the caller object first, if class not found we try with Thread's context ClassLoader (TCCL).
      static Class<?> loadClass​(String type, Class<?> callerClass)
      Loads the class using the ClassLoader corresponding to the caller class first, if class not found we try with Thread's context ClassLoader (TCCL).
      static Class<?> loadClass​(String type, Object callerObject)
      Loads the class using the ClassLoader corresponding to the caller object first, if class not found we try with Thread's context ClassLoader (TCCL).
    • Constructor Detail

      • ClassLoading

        public ClassLoading()
    • Method Detail

      • forName

        public static Class<?> forName​(String type,
                                       Object callerObject)
                                throws ClassNotFoundException
        Loads the class using the ClassLoader corresponding to the caller object first, if class not found we try with Thread's context ClassLoader (TCCL). If the TCCL doesn't exist or the class still cannot be found, we use the System class loader.
        Parameters:
        type - FQN of class to load
        callerObject - the object from which we want to load the class
        Returns:
        Loaded class
        Throws:
        ClassNotFoundException
      • forName

        public static Class<?> forName​(String type,
                                       Class<?> callerClass)
                                throws ClassNotFoundException
        Loads the class using the ClassLoader corresponding to the caller class first, if class not found we try with Thread's context ClassLoader (TCCL). If the TCCL doesn't exist or the class still cannot be found, we use the System class loader.
        Parameters:
        type - FQN of class to load
        callerClass - the class from which we want to load the class
        Returns:
        Loaded class
        Throws:
        ClassNotFoundException
      • loadClass

        public static Class<?> loadClass​(String type,
                                         Object callerObject)
                                  throws ClassNotFoundException
        Loads the class using the ClassLoader corresponding to the caller object first, if class not found we try with Thread's context ClassLoader (TCCL). If the TCCL doesn't exist or the class still cannot be found, we use the System class loader.
        Parameters:
        type - FQN of class to load
        callerObject - the object from which we want to load the class
        Returns:
        Loaded class
        Throws:
        ClassNotFoundException
      • loadClass

        public static Class<?> loadClass​(String type,
                                         Class<?> callerClass)
                                  throws ClassNotFoundException
        Loads the class using the ClassLoader corresponding to the caller class first, if class not found we try with Thread's context ClassLoader (TCCL). If the TCCL doesn't exist or the class still cannot be found, we use the System class loader.
        Parameters:
        type - FQN of class to load
        callerClass - the class from which we want to load the class
        Returns:
        Loaded class
        Throws:
        ClassNotFoundException