org.cesta.loader
Class AdvancedClassLoader<C>

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by org.cesta.loader.AdvancedClassLoader<C>
Direct Known Subclasses:
TransformationLoader

public class AdvancedClassLoader<C>
extends java.security.SecureClassLoader

Type safe class loader for specified class.

Author:
Tobias Smolka

Field Summary
protected  java.lang.Class<C> innerClass
           
protected  java.util.ServiceLoader<C> serviceLoader
           
 
Constructor Summary
  AdvancedClassLoader(java.lang.Class<C> innerClass)
           
protected AdvancedClassLoader(java.lang.Class<C> innerClass, java.lang.ClassLoader parent)
           
 
Method Summary
 C getInstance(java.lang.String name)
           
 java.util.ServiceLoader<C> getServiceLoader()
           
 java.lang.Object getStaticField(java.lang.Class<C> cl, java.lang.String fieldName)
          Returns static field object with given name from given class.
 java.lang.Object getStaticField(java.lang.String className, java.lang.String fieldName)
          Return static field object with given name from given class.
 java.lang.Class<C> loadInnerClass(java.lang.String name)
          Returns class with given name or null, if not found.
 void reload()
           
 void setServiceLoader(java.util.ServiceLoader<C> serviceLoader)
           
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass, getPermissions
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serviceLoader

protected java.util.ServiceLoader<C> serviceLoader

innerClass

protected java.lang.Class<C> innerClass
Constructor Detail

AdvancedClassLoader

protected AdvancedClassLoader(java.lang.Class<C> innerClass,
                              java.lang.ClassLoader parent)

AdvancedClassLoader

public AdvancedClassLoader(java.lang.Class<C> innerClass)
Method Detail

reload

public void reload()

getServiceLoader

public java.util.ServiceLoader<C> getServiceLoader()
Returns:
the serviceLoader

setServiceLoader

public void setServiceLoader(java.util.ServiceLoader<C> serviceLoader)
Parameters:
serviceLoader - the serviceLoader to set

loadInnerClass

public java.lang.Class<C> loadInnerClass(java.lang.String name)
Returns class with given name or null, if not found. The name can be full class name (with package) or name of class from default package.

Parameters:
name - Name of transformation class
Returns:
transformation class

getInstance

public C getInstance(java.lang.String name)
              throws java.lang.InstantiationException,
                     java.lang.IllegalAccessException
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException

getStaticField

public java.lang.Object getStaticField(java.lang.String className,
                                       java.lang.String fieldName)
Return static field object with given name from given class.

Parameters:
className - name of class
fieldName - name of field
Returns:
object or null if not found

getStaticField

public java.lang.Object getStaticField(java.lang.Class<C> cl,
                                       java.lang.String fieldName)
Returns static field object with given name from given class.

Parameters:
cl - class
fieldName - name of field
Returns:
object or null if not found