ch.elca.el4j.util.interfaceenrichment
Class InterfaceEnricher

java.lang.Object
  extended by ch.elca.el4j.util.interfaceenrichment.InterfaceEnricher

public class InterfaceEnricher
extends Object

This class generates an enriched shadow interface for an existing interface. The interface EnrichmentDecorator describes how the shadow interface is changed from the existing interface. The interface's bytecode is generated during runtime. Its bytecode can either be directly loaded or it can be saved to a file. The loading of the bytecode is done as in the cglib library. Possible usages for this: *One can create RMI or EJB-conformant interface for any Java interface (E.g. by implementing java.ejb.Remote and by adding RemoteExceptions) *One can add additional parameters to each method of an interface. This can be used for implicit context passing via remoting protocols that do not support it. Please refer to the remoting of EL4J. *Writing other decorators or adapters that need to have an interface that is slightly modified.

Author:
Martin Zeltner (MZE)
See Also:
EnrichmentDecorator
File-location:
InterfaceEnricher
Last check-in date:
2009-08-04 15:06:35 +0200 (Di, 04. Aug 2009) by swismer for revision 3878

Constructor Summary
InterfaceEnricher()
           
 
Method Summary
 byte[] createShadowInterface(Class<?> serviceInterfaceOld, EnrichmentDecorator interfaceDecorator)
          Creates a shadow interface and returns it as a byte array.
 Class<?> createShadowInterfaceAndLoadItDirectly(Class<?> serviceInterfaceOld, EnrichmentDecorator interfaceDecorator, ClassLoader cl)
          Creates a shadow interface, loads it in the given class loader and returns the loaded class as a class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterfaceEnricher

public InterfaceEnricher()
Method Detail

createShadowInterface

public byte[] createShadowInterface(Class<?> serviceInterfaceOld,
                                    EnrichmentDecorator interfaceDecorator)
Creates a shadow interface and returns it as a byte array.

Parameters:
serviceInterfaceOld - Is the interface which has to be converted.
interfaceDecorator - Is the decorator which tolds how does the given interface has to be changed.
Returns:
Returns the generated shadow interface as a byte array.

createShadowInterfaceAndLoadItDirectly

public Class<?> createShadowInterfaceAndLoadItDirectly(Class<?> serviceInterfaceOld,
                                                       EnrichmentDecorator interfaceDecorator,
                                                       ClassLoader cl)
Creates a shadow interface, loads it in the given class loader and returns the loaded class as a class.

Parameters:
serviceInterfaceOld - Is the interface which has to be converted.
interfaceDecorator - Is the decorator which tolds how does the given interface has to be changed.
cl - Is the ClassLoader where to load the generated class.
Returns:
Returns the generated shadow interface as a class.


Copyright © 2005-2011 ELCA. All Rights Reserved.