|
Invocation API 1.1.0.Final | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.invocation.proxy.AbstractClassFactory<T>
T
- the type of the superclasspublic abstract class AbstractClassFactory<T>
Base class for all class factories.
Sub classes should overridegenerateClass()
to perform the actual class generation. The class will only be generated
once at most
Field Summary | |
---|---|
protected org.jboss.classfilewriter.ClassFile |
classFile
The class file that is used to generate the class. |
Constructor Summary | |
---|---|
protected |
AbstractClassFactory(String className,
Class<T> superClass)
Construct a new instance with a null protection domain. |
protected |
AbstractClassFactory(String className,
Class<T> superClass,
ClassLoader classLoader)
Construct a new instance with a null protection domain. |
protected |
AbstractClassFactory(String className,
Class<T> superClass,
ClassLoader classLoader,
ProtectionDomain protectionDomain)
Construct a new instance. |
Method Summary | |
---|---|
void |
afterClassLoad(Class<?> clazz)
Hook that is called after the class is loaded, before cleanup() is called. |
void |
buildClassDefinition()
Generates the class |
protected abstract void |
cleanup()
Cleans up any resources left over from generating the class. |
Class<? extends T> |
defineClass()
Returns the Class object for the generated class, creating it if it does not exist |
protected abstract void |
generateClass()
Generate the class. |
ClassLoader |
getClassLoader()
Get the defining class loader. |
String |
getClassName()
Get the class name. |
ProtectionDomain |
getProtectionDomain()
Get the defined protection domain. |
Class<T> |
getSuperClass()
Get the superclass. |
String |
getSuperClassName()
Get the superclass name. |
boolean |
isProxyClassDefined()
Checks if the proxy class is defined in the factories class loader |
boolean |
isProxyClassDefined(ClassLoader classLoader)
Checks if the proxy class has been defined in the given class loader |
T |
newInstance()
Creates a new instance of the generated class by invoking the default constructor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.jboss.classfilewriter.ClassFile classFile
generateClass()
will only be called once
by a single thread.
Constructor Detail |
---|
protected AbstractClassFactory(String className, Class<T> superClass, ClassLoader classLoader, ProtectionDomain protectionDomain)
className
- the generated class namesuperClass
- the superclass of the generated classclassLoader
- the class loader used to load the classprotectionDomain
- the protection domain of the classprotected AbstractClassFactory(String className, Class<T> superClass, ClassLoader classLoader)
null
protection domain.
className
- the generated class namesuperClass
- the superclass of the generated classclassLoader
- the class loader used to load the classprotected AbstractClassFactory(String className, Class<T> superClass)
null
protection domain.
className
- the generated class namesuperClass
- the superclass of the generated classMethod Detail |
---|
protected abstract void generateClass()
protected abstract void cleanup()
public void afterClassLoad(Class<?> clazz)
cleanup()
is called.
This method may be called mutiple times, if the proxy is definined in multiple class loaders
clazz
- The newly loaded classpublic Class<? extends T> defineClass()
Class
object for the generated class, creating it if it does not exist
public boolean isProxyClassDefined()
public boolean isProxyClassDefined(ClassLoader classLoader)
classLoader
- The class loader to check
public void buildClassDefinition()
public T newInstance() throws InstantiationException, IllegalAccessException
InstantiationException
- if the new instance could not be created
IllegalAccessException
- if the new constructor is inaccessible for some reasonpublic String getClassName()
public String getSuperClassName()
public Class<T> getSuperClass()
public ClassLoader getClassLoader()
public ProtectionDomain getProtectionDomain()
|
Invocation API 1.1.0.Final | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |