Invocation API 1.1.0.Final

org.jboss.invocation.proxy
Class AbstractProxyFactory<T>

java.lang.Object
  extended by org.jboss.invocation.proxy.AbstractClassFactory<T>
      extended by org.jboss.invocation.proxy.AbstractSubclassFactory<T>
          extended by 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
protected AbstractProxyFactory(String className, Class<T> superClass, ClassLoader classLoader, ProtectionDomain protectionDomain, ReflectionMetadataSource reflectionMetadataSource)
          Construct a new instance.
 
Method Summary
 void afterClassLoad(Class<?> clazz)
          Sets the accessible flag on the cached methods
protected  void cleanup()
          Cleans up any resources left over from generating the class.
protected  void finalizeStaticConstructor()
          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  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.

 
Methods inherited from class org.jboss.invocation.proxy.AbstractSubclassFactory
addInterface, addInterface, createConstructorDelegates, createConstructorDelegates, getDefaultConstructorOverride, getDefaultMethodOverride, overrideAllMethods, overrideAllMethods, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractProxyFactory

protected AbstractProxyFactory(String className,
                               Class<T> superClass,
                               ClassLoader classLoader,
                               ProtectionDomain protectionDomain,
                               ReflectionMetadataSource reflectionMetadataSource)
Construct a new instance.

Parameters:
className - the class name
superClass - the superclass
classLoader - the defining class loader
protectionDomain - 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:
afterClassLoad in class AbstractClassFactory<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 proxies InvocationHandler when 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:
cleanup in class AbstractSubclassFactory<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 load
method - the subclass method to populate

Invocation API 1.1.0.Final

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.