Pattern expansion

To implement the intended pattern behaviors when the pattern is applied, pattern expansion code is provided by the pattern author for each parameter and is invoked when that parameter is bound. Thus, expansion occurs on an incremental basis.

As arguments are specified by the pattern applier, the results of the bound and expanded argument are immediately observable in the target elements. Because parameters are expanded independently, the pattern applier can select to apply only the pattern parameters that are solutions to the current design problem. More than one instance of the pattern can exist at one time and patterns can be applied multiple times to target elements. The pattern author dictates which pattern parameters are optional and this is typically communicated to the pattern applier through the pattern parameter multiplicity lower bound being zero

An exception to parameter independence is the use of dependencies between parameters. This applies to parameters that require the values from another parameter for expansion. Pattern parameter dependencies are not to be confused with UML dependency relationships. When the dependency Client or Supplier property is set in the pattern model, empty update methods are generated in the pattern. These methods are ready for the pattern author to code the expansion sequence based on the inter parameter's requirements.

For help with code design, see the com.ibm.xtools.patterns.framework package that contains the AbstractPatternParameter and the PatternParameterValue classes. The AbstractPatternParameter class is the common implementation for a pattern parameter and another subclass indirectly uses and further specializes it. The PatternParameterValue class encapsulates all the information needed to qualify a value to the proper pattern parameter and pattern instance, plus provides nested subclasses that provide state-specific behavior corresponding to the state of the pattern parameter value.


Feedback