Package org.jboss.invocation.proxy
Class AbstractProxyFactory<T>
- java.lang.Object
-
- org.jboss.invocation.proxy.AbstractClassFactory<T>
-
- org.jboss.invocation.proxy.AbstractSubclassFactory<T>
-
- org.jboss.invocation.proxy.AbstractProxyFactory<T>
-
- Type Parameters:
T- the superclass type
- Direct Known Subclasses:
ProxyFactory
public abstract class AbstractProxyFactory<T> extends AbstractSubclassFactory<T>
A subclass factory specializing in proxy generation.
-
-
Field Summary
-
Fields inherited from class org.jboss.invocation.proxy.AbstractSubclassFactory
reflectionMetadataSource
-
Fields inherited from class org.jboss.invocation.proxy.AbstractClassFactory
classFile
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractProxyFactory(String className, Class<T> superClass, ClassLoader classLoader, ProtectionDomain protectionDomain, ReflectionMetadataSource reflectionMetadataSource)protectedAbstractProxyFactory(String className, Class<T> superClass, ClassLoader classLoader, org.jboss.classfilewriter.ClassFactory classFactory, ProtectionDomain protectionDomain, ReflectionMetadataSource reflectionMetadataSource)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterClassLoad(Class<?> clazz)Sets the accessible flag on the cached methodsprotected voidcleanup()Cleans up any resources left over from generating the class.protected voidfinalizeStaticConstructor()This method must be called by subclasses after they have finished generating the class.List<Method>getCachedMethods()Returns all Method objects that are cached by the proxy.protected voidloadMethodIdentifier(Method methodToLoad, org.jboss.classfilewriter.ClassMethod method)Writes the bytecode to load an instance of Method for the given method onto the stack-
Methods inherited from class org.jboss.invocation.proxy.AbstractSubclassFactory
addInterface, addInterface, createConstructorDelegates, createConstructorDelegates, getDefaultConstructorOverride, getDefaultMethodOverride, overrideAllMethods, overrideAllMethods, overrideClone, overrideClone, overrideEquals, overrideEquals, overrideFinalize, overrideFinalize, overrideHashcode, overrideHashcode, overrideMethod, overrideMethod, overridePublicMethods, overridePublicMethods, overrideToString, overrideToString
-
Methods inherited from class org.jboss.invocation.proxy.AbstractClassFactory
buildClassDefinition, defineClass, generateClass, getClassLoader, getClassName, getProtectionDomain, getSuperClass, getSuperClassName, isProxyClassDefined, isProxyClassDefined, newInstance
-
-
-
-
Constructor Detail
-
AbstractProxyFactory
@Deprecated protected AbstractProxyFactory(String className, Class<T> superClass, ClassLoader classLoader, ProtectionDomain protectionDomain, ReflectionMetadataSource reflectionMetadataSource)
Deprecated.Construct a new instance.- Parameters:
className- the class namesuperClass- the superclassclassLoader- the defining class loaderprotectionDomain- the protection domain
-
AbstractProxyFactory
protected AbstractProxyFactory(String className, Class<T> superClass, ClassLoader classLoader, org.jboss.classfilewriter.ClassFactory classFactory, ProtectionDomain protectionDomain, ReflectionMetadataSource reflectionMetadataSource)
Construct a new instance.- Parameters:
className- the class namesuperClass- the superclassclassLoader- the defining class loaderprotectionDomain- the protection domain
-
-
Method Detail
-
finalizeStaticConstructor
protected void finalizeStaticConstructor()
This method must be called by subclasses after they have finished generating the class.
-
afterClassLoad
public void afterClassLoad(Class<?> clazz)
Sets the accessible flag on the cached methods- Overrides:
afterClassLoadin classAbstractClassFactory<T>- Parameters:
clazz- The newly loaded class
-
getCachedMethods
public List<Method> getCachedMethods()
Returns all Method objects that are cached by the proxy. These Methods objects are passed to the proxiesInvocationHandlerwhen the corresponding proxy action is invoked- Returns:
- The cached methods
-
cleanup
protected void cleanup()
Cleans up any resources left over from generating the class. Implementors should ensure they call super.cleanup();- Overrides:
cleanupin classAbstractSubclassFactory<T>
-
loadMethodIdentifier
protected void loadMethodIdentifier(Method methodToLoad, org.jboss.classfilewriter.ClassMethod method)
Writes the bytecode to load an instance of Method for the given method onto the stack If loadMethod has not already been called for the given method then a static field to hold the method is added to the class, and code is added to the static constructor to initialize the field to the correct Method.- Parameters:
methodToLoad- the method to loadmethod- the subclass method to populate
-
-