LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.misc
Class LyClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by leon.misc.LyClassLoader

public class LyClassLoader
extends java.lang.ClassLoader

This class defines a specific class loader that enable to load classes located on the computer's disk but not defined inside the CLASSPATH properties.
How to use: in order to load a specific class, create a LyClassLoader with a classpath that contains its file definition. Each path of the classpath are separated with the system path separator (File.pathSeparatorChar). The classpath can contains directories, ZIP or JAR archives.
Example :

Remark: if the class was previously loaded by the primordial class loader, the loadClass method returns the reference of the existing class that corresponds to the given name. Once a class is loaded, it is stored and won't be reloaded anymore.


Field Summary
static java.lang.String __VERSION
           
 
Constructor Summary
LyClassLoader(java.lang.String classpath)
          Class constructor, initialize the classpath with the given value.
 
Method Summary
 java.lang.Class<?> loadClass(java.lang.String className)
          Loads the given class.
 java.lang.Class<?> loadClass(java.lang.String className, boolean resolveIt)
          Specific implementation of loadClass : loads the class from the file inside the classpath and then creates a instance of Class.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values
Constructor Detail

LyClassLoader

public LyClassLoader(java.lang.String classpath)
Class constructor, initialize the classpath with the given value.

Parameters:
classpath - The classpath that defines were classes files are located : this is a string that defines several path separated with the system path separator File.pathSeparatorChar .
Method Detail

loadClass

public java.lang.Class<?> loadClass(java.lang.String className)
                             throws java.lang.ClassNotFoundException
Loads the given class. Invoking this method is equivalent to invoking loadClass(name, true).

Overrides:
loadClass in class java.lang.ClassLoader
Parameters:
className - The fully qualified name of the desired class.
Returns:
The loaded Class.
Throws:
java.lang.ClassNotFoundException - if the class is not found
See Also:
loadClass(String, boolean)

loadClass

public java.lang.Class<?> loadClass(java.lang.String className,
                                    boolean resolveIt)
                             throws java.lang.ClassNotFoundException
Specific implementation of loadClass : loads the class from the file inside the classpath and then creates a instance of Class. If the class has been already loaded by the primordial class loader, then this reference is returned. *

Overrides:
loadClass in class java.lang.ClassLoader
Parameters:
className - the complete class name with the package definition (ex: leon.misc.LyClassLoader)
resolveIt - indicates if the class has to be resolved or not.
Returns:
the found Class object.
Throws:
java.lang.ClassNotFoundException - if the class is not found
java.lang.ClassFormatError - if the retrieved class does not matches the class format.

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com