All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.dip.DippableGenerator

java.lang.Object
   |
   +----com.ibm.beans.dip.DippableGenerator

public class DippableGenerator
extends Object
This class generates the source for a dippable class. The dippable class contains all the logic required to manage the dips. This process is called morphing.

The DippableGenerator class has two options for it's main input: a String containing the name of a class or a String containing the name of an interface plus a corresponding implementation bean.

If given the name of a class, the DippableGenerator class creates a class reference and, using introspection, produces a subclass of the class object. This subclass of the class object implements the Dippable interface. This subclass of the class object also contains a reference to a DippableSupport object. The new dippable class is a child of the original class. The generated subclass object overrides all public and protected methods of the original class and all the base classes of the original class.

If given an interface and implementation pair, the DippableGenerator class still creates a class object. However, this class object implements the input interface as well as the Dippable interface. This class object also contains a reference to both the input implementation bean and an implementation of the DippableSupport interface. Using this approach, the dippable class is not a subclass of the implementation object, it implements the interface and uses the implementation object.


Constructor Index

 o DippableGenerator(String, String, Boolean, Boolean, String, String, Boolean, String, Boolean, String, Comment, OutputStream, Boolean, OutputStream)
Constructs a DippableGenerator.

Method Index

 o getMorphedClassName(String, String)
Determines the new name for the morphed class given the original className.
 o morph()
Morphs the bean.
 o outputClassDeclaration()
Outputs the dippable class declaration.
 o outputConstructors()
Outputs the constructor definitions.
 o outputEventMethods()
Outputs the event method definitions.
 o outputGeneralMethods()
Outputs the general method definitions.
 o outputImportDeclarations()
Outputs the import declarations.
 o outputPackageDeclaration()
Outputs the package declaration.
 o outputPropertyMethods()
Outputs the property method definitions.

Constructors

 o DippableGenerator
 public DippableGenerator(String className,
                          String impName,
                          Boolean extended,
                          Boolean override,
                          String additionalAPIs,
                          String dips,
                          Boolean dipsSpecifyOverrides,
                          String newClassName,
                          Boolean finalClass,
                          String finalMethods,
                          Comment aComment,
                          OutputStream beanOstr,
                          Boolean beanInfoCreated,
                          OutputStream beanInfoOstr)
Constructs a DippableGenerator.

Parameters:
className -
A String containing either the package qualified class name for the morph candidate bean or a String containing both a package qualified interface name and a corresponding package qualified implementation bean. If given a class+interface pair, the class name is always first and the interface name is always second, and they are separated by a plus sign (+).
impName -
The package qualified class name of the DippableSupport or DippableExtendedSupport implementation class used by this dippable bean. This parameter can be null which causes the either the com.ibm.beans.DippableSupportImp class or the com.ibm.beans.DippableExtendedSupportImp class to be used. The decision on which implementation class should be used as the default is based on the setting of the extended flag.
extended -
This flag indicates which interface the dippable bean should override.
true means implement DippableExtended; false means implement only Dippable.

This parameter can be null.

override -
This flag indicates which methods the dippable bean should override.
true means override all general methods from all parent classes; false means override only the general methods in the original bean.

Only valid if the input is a class.

This parameter can be null.

additionalAPIs -
A String containing a series of class+interface pairs to be added to the API of the generated dippable bean. For each class+interface pair, the dippable bean implements the interface and uses the implementation. In the String, the class name is always first, the interface name is always second, and they are separated by a plus sign (+). Pairs are separated in the string by a semicolon (;).

additionalAPIs should be added with great care. If the original bean implemented, for example, the Cloneable interface; the dippable bean with the additional APIs may no longer correctly implement the Cloneable interface. This is because the dippable bean just uses the original implementation for the clone() method, and the original implementation does not know about the data added by the additional APIs, which needs to be included in the clone method.

Another reason additionalAPIs should be added with great care is because adding a class+interface pair to the dippable bean can make a new dippable bean that is not thread-safe or is not immutable, although the original bean was thread-safe or immutable.

This parameter can be null.

dips -
A String containing a series of dips to be applied to the dippable bean during construction. These dips must be beans because they are instantiated with Beans.instantiate(). Dips are separated in the String by a semicolon (;).

This parameter can be null.

dipsSpecifyOverrides -
This flag indicates that the dips specified in the dips parameters should specify which methods should be overridden in the dippable class.
true means the dips specify which methods to override; false otherwise.

Only valid if the dips parameter is provided.

This parameter can be null.

newClassName -
A String containing a name for the new dippable bean. If null, the name of the dippable bean is be based on the className argument.

This parameter can be null.

finalClass -
This flag indicates the new dippable class should be a final class.
true means create a final class; false otherwise.

This parameter can be null.

finalMethods -
A String containing a series of method names. All methods equaling these method names will be made final methods in the new dippable class. Method names are separated in the String by a semicolon (;).

Only valid if the finalClass parameter is provided.

This parameter can be null.

aComment -
A Comment object reference.

This parameter can be null which causes a default Comment object to be created.

beanOstr -
The code for the new dippable bean is written to this OutputStream instance.

This parameter can be null which causes output to be directed to System.out.

beanInfoCreated -
This flag indicates whether a BeanInfo class should should be created.
true means create a corresponding BeanInfo; false means do not.

This parameter can be null.

beanInfoOstr -
The code for the BeanInfo for the new dippable bean is written to this OutputStream instance.

This parameter can be null which causes output to be directed to System.out.

Methods

 o getMorphedClassName
 public static final String getMorphedClassName(String originalClassName,
                                                String originalInterfaceName)
Determines the new name for the morphed class given the original className.

Parameters:
originalClassName - The name of the original, un-morphed class
originalInterfaceName - null if the new morphed class is to be created through inheritance. The name of the original interface if the new morphed class is to be created through aggregation.
Returns:
The new name of the morphed class.
 o morph
 public void morph()
Morphs the bean. This method calls all other DippableGenerator output methods.

 o outputPackageDeclaration
 protected void outputPackageDeclaration()
Outputs the package declaration. Morphed beans are put into the same package as their parents.

 o outputImportDeclarations
 protected void outputImportDeclarations()
Outputs the import declarations.

 o outputClassDeclaration
 protected void outputClassDeclaration()
Outputs the dippable class declaration.

 o outputConstructors
 protected void outputConstructors()
Outputs the constructor definitions.

 o outputEventMethods
 protected void outputEventMethods()
Outputs the event method definitions.

 o outputPropertyMethods
 protected void outputPropertyMethods()
Outputs the property method definitions.

 o outputGeneralMethods
 protected void outputGeneralMethods()
Outputs the general method definitions.


All Packages  Class Hierarchy  This Package  Previous  Next  Index