org.jboss.proxy.compiler
Class ProxyImplementationFactory

java.lang.Object
  extended byorg.jboss.proxy.compiler.ProxyImplementationFactory

public class ProxyImplementationFactory
extends java.lang.Object

Factory to create the bytecode implementation of various methods required by the ProxyCompiler.


Constructor Summary
ProxyImplementationFactory(java.lang.String superClassName, java.lang.String proxyClassName, ClassGen cg)
          Creates a new ProxyImplementationFactory instance.
 
Method Summary
 Method createConstructor()
          generate an implementation of
 Method createGetInvocationHandler()
          generate an implementation of
 Method createGetTargetTypes()
          generate an implementation of
 Field createInvocationHandlerField()
          generate a field declaration of the form...
 Method createProxyMethod(java.lang.String name, int methodNum, Type rType, Type[] pTypes, java.lang.String[] exceptionNames)
          generate an implementation of...
 Field createRuntimeField()
          generate a field declaration of the form...
 Method createToString()
          generate an implementation of
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyImplementationFactory

public ProxyImplementationFactory(java.lang.String superClassName,
                                  java.lang.String proxyClassName,
                                  ClassGen cg)
Creates a new ProxyImplementationFactory instance.

Parameters:
superClassName - a String value
proxyClassName - a String value
cg - a ClassGen value
Method Detail

createGetInvocationHandler

public Method createGetInvocationHandler()
generate an implementation of

 
    public InvocationHandler getInvocationHandler() {
       return this.invocationHandler;
    }
 

 


createGetTargetTypes

public Method createGetTargetTypes()
generate an implementation of

 
   public Class[] getTargetTypes {
      return this.invocationHandler.copyTargetTypes();
   }
 

 

Returns:
the method

createToString

public Method createToString()
generate an implementation of

 
    public String toString() {
       return "ProxyTarget[" + invocationHandler + "]";
    }
 

 

Returns:
the method

createConstructor

public Method createConstructor()
generate an implementation of

 
   public <proxyClassName> (InvocationHandler h) {
      this.invocationHandler = h;
   }
 

 

Returns:
the method

createProxyMethod

public Method createProxyMethod(java.lang.String name,
                                int methodNum,
                                Type rType,
                                Type[] pTypes,
                                java.lang.String[] exceptionNames)
generate an implementation of...

 
   public <return type> <method name>(<p0 type> p0, <p1 type> p1, ...)
      throws e0, e1 ... 
   {
      return runtme.invoke(invocatioHandler, <method index>,
                           new Object[]{boxed p0, boxed p1, ...)};
   }                 
 

 

Returns:
the method

createInvocationHandlerField

public Field createInvocationHandlerField()
generate a field declaration of the form...

 
   private InvocationHandler invocationHandler;
 

 

Returns:
the method

createRuntimeField

public Field createRuntimeField()
generate a field declaration of the form...

 
   public static Runtime runtime;
 

 

Returns:
the method