Smartproxy
0.2

net.ggtools.smartproxy
Class SimpleProxyClassGenerator

java.lang.Object
  extended bynet.ggtools.smartproxy.SimpleProxyClassGenerator
All Implemented Interfaces:
ProxyClassGenerator

public class SimpleProxyClassGenerator
extends Object
implements ProxyClassGenerator

A proxy class generator used when the base and underlying interfaces are the same. This class generator use the following rules:

  1. methods from the base interface implemented in the implementor class are not overridden,
  2. methods from the base interface not implemented in the implementor class are implemented as:
        public returnType method(params)
        {
           return ((base interface)getUnderlying()).method(params);
        }
     
    or
        public void method(params)
        {
           ((base interface)getUnderlying()).method(params);
        }
     
  3. constructors from the implementor class will be implemented in the smart proxy class as:
        smart proxy class(params)
        {
           super(params);
        }
     

Author:
Christophe Labouisse

Method Summary
 void addConstructor(Constructor constructor)
          Add a new constructor to the proxy class.
 void addProxyMethod(Method method)
          Add a new proxified method.
 JavaClass getJavaClass()
          Get the BCEL class for the generated class.
 void init()
          Initialize the object for a new class generation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

init

public void init()
Initialize the object for a new class generation. Any class generated so far will be lost. This method must be called before addConstructor of addProxyMethod.

Specified by:
init in interface ProxyClassGenerator

addConstructor

public void addConstructor(Constructor constructor)
                    throws IllegalStateException
Description copied from interface: ProxyClassGenerator
Add a new constructor to the proxy class.

Specified by:
addConstructor in interface ProxyClassGenerator
Parameters:
constructor -
Throws:
IllegalStateException - init wasn't called previously.

addProxyMethod

public void addProxyMethod(Method method)
                    throws IllegalStateException
Description copied from interface: ProxyClassGenerator
Add a new proxified method.

Specified by:
addProxyMethod in interface ProxyClassGenerator
Parameters:
method -
Throws:
IllegalStateException - init wasn't called previously.

getJavaClass

public JavaClass getJavaClass()
                       throws IllegalStateException
Get the BCEL class for the generated class.

Specified by:
getJavaClass in interface ProxyClassGenerator
Returns:
the class generated.
Throws:
IllegalStateException - init wasn't called previously.

Smartproxy
0.2