Defining expansion methods

When you add a parameter to a pattern in the Pattern Authoring view, a parameter class with two expansion methods is added to the pattern implementation model.

Expansion methods and the optional update methods are known as hot spots. You add Java™ code to the hot spots to dictate the pattern behavior when an argument value is added to or removed from a parameter. The following methods show the expansion methods:


The expansion method code for adding an argument.


The expansion method code for removing an argument.

To assist you with your code design, refer to the resources available in the pattern online help for the pattern framework and other references. To open the references, click Reference > Modeler's reference > Feature reference > Extensibility reference, expand either API reference or Extention Points Reference and then click one of the Patterns topics.

To add expansion code:

  1. In the Pattern Authoring view, double-click the parameter to locate the parameter code in the Java editor.
  2. Replace the TODO comments in both methods with the code that performs the required behavior when an argument is added to or removed from the parameter in the pattern instance.
  3. Remove the @generated tag from any method that you modify to prohibit the pattern authoring tool from regenerating and removing your code.
Note: To better understand pattern behavior, you can practice applying patterns by using the sample patterns. You can load the sample patterns by clicking Help > Samples Gallery, expanding Technology samples, expanding Patterns, and clicking Patterns to apply. In the Patterns to apply topic, click Import the sample. To better understand how to create patterns, you can import the example patterns by clicking File > New > Other, in the New window, expand Examples, expand UML Modeler Plug-ins, and click Pattern Library Examples.

Parent topic: Supplying implementation code for patterns

Related concepts
Pattern code and support files
Pattern expansion

Related tasks
Defining update methods
Regenerating source code
Regenerating pattern definitions

Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.