Class ClassLoading

java.lang.Object
org.exoplatform.commons.utils.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
     
  • Method Summary

    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).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ClassLoading

      public ClassLoading()
  • Method Details

    • 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