Adding method features

Define method features to represent bean behaviors or functions that you want other beans to have access to.

Add a new method feature in the BeanInfo page as follows:

  1. From the tool bar, select (New method icon) New Method Feature. If you prefer, you can select New Method Feature from the Features menu. Either selection opens the SmartGuide - New Method Feature window.

  2. In the SmartGuide - New Method Feature window, do the following:

    1. Specify the method name in the Method name field.

    2. Specify the method return type in the Return type field.

    3. If your method feature requires parameter input, specify the number of parameters in the Parameter count field.

    4. Select Next to open the either the SmartGuide - Parameter window or the SmartGuide - Bean Information window.

  3. In the SmartGuide - Parameter window for each parameter, do the following:

    1. Specify the parameter name in the Parameter name field.

    2. Specify the parameter type in the Parameter type field.

    3. If you want a name other than the actual parameter name to be displayed for the parameter in the Visual Composition Editor, specify the name in the Display name field. This name appears when the parameter is listed in visual composition windows.

    4. If you want a description other than the feature name to be displayed for the parameter in the Visual Composition Editor, specify the description in the Short description field. This description appears when the parameter is selected in visual composition windows.

    5. Select Next to open the SmartGuide - Bean Information window.

  4. In the SmartGuide - Bean Information window, do the following:

    1. If you want a name other than the actual feature name to be displayed for the method in the Visual Composition Editor, specify the name in the Display name field. This name appears when the method is listed in connection menus, the Promote Features window, and other windows.

    2. If you want a description other than the feature name to be displayed for the method in the Visual Composition Editor, specify the description in the Short description field. This description appears in certain windows, such as connection windows and the Promote Features window, when the method is selected.

    3. If you do not want the method to appear in development windows unless the user chooses to display expert features, select the expert check box.

    4. If you do not want the method to be exposed to the bean consumer, select the hidden check box.

    5. Select Finish to add the method. VisualAge generates the following:
      • A public method for the feature in the bean class
      • Bean information code that describes the feature in the BeanInfo class for the bean

You can modify BeanInfo for the method in the Information pane of the BeanInfo page. If you want the method to appear as a preferred feature in the connection menu of the bean, set the feature's Preferred property to true.


Related concepts
Feature naming guidelines
Generated code

Related procedures
Defining bean interfaces for visual composition
Creating and modifying a BeanInfo class
Specifying expert features
Specifying hidden features

Related references
New Method Feature SmartGuide
Parameter SmartGuide
Bean Information SmartGuide
Features pane--BeanInfo page