aokell.lib.interf
Class Delegator

java.lang.Object
  extended by aokell.lib.interf.Delegator
Direct Known Subclasses:
DelegatorForBoundableInterface, DelegatorForImplementedInterface

public abstract class Delegator
extends Object

This class defines methods shared by all classes which generate at runtime implementations of the Interface interface.

Author:
Lionel Seinturier

Constructor Summary
Delegator()
           
 
Method Summary
static void dumpClassToFile(String dirname, String classname, byte[] b)
          Utility method to write the bytecode from a class to a file.
 void dumpProxies(String dirname)
          Dump the generated proxy classes in a given directory.
 Object generate(InterfaceType it, Component itfOwner, Object content, boolean isFcInternalInterface)
          Generate and instantiate a proxy which implements the same interface as a delegate and that extends the InterfaceImpl class.
protected abstract  ClassDefinition generateDelegator(String targetClassname, String delegateClassname)
          Generate a proxy that implements the same interface as a delegate and that extends the InterfaceImpl class.
protected  Class getClass(String targetClassname, String delegateClassname)
          Utility method to retrieve a class which has already been generated.
protected  void registerProxy(String targetClassname, ClassDefinition cd)
          Store a generated proxy class into the map of proxy classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Delegator

public Delegator()
Method Detail

generate

public Object generate(InterfaceType it,
                       Component itfOwner,
                       Object content,
                       boolean isFcInternalInterface)
Generate and instantiate a proxy which implements the same interface as a delegate and that extends the InterfaceImpl class.

Parameters:
it - the interface type
itfOwner - the component associated to the interface
content - the content to which the call must be delegated
isFcInternalInterface - true if the generated proxy is an internal interface
Returns:
the proxy

generateDelegator

protected abstract ClassDefinition generateDelegator(String targetClassname,
                                                     String delegateClassname)
Generate a proxy that implements the same interface as a delegate and that extends the InterfaceImpl class.


getClass

protected Class getClass(String targetClassname,
                         String delegateClassname)
                  throws ClassNotFoundException
Utility method to retrieve a class which has already been generated.

Throws:
ClassNotFoundException

registerProxy

protected void registerProxy(String targetClassname,
                             ClassDefinition cd)
Store a generated proxy class into the map of proxy classes.


dumpClassToFile

public static void dumpClassToFile(String dirname,
                                   String classname,
                                   byte[] b)
                            throws IOException
Utility method to write the bytecode from a class to a file. This method creates the directory structure corresponding to package names.

Parameters:
dirname - the root directory name
classname - the name of the class
b - the bytecode
Throws:
IOException

dumpProxies

public void dumpProxies(String dirname)
Dump the generated proxy classes in a given directory.

Parameters:
dirname - the directory name where the classes must be generated