Create Attributes for a User Class
When you define attributes for a user class, you specify:
• The name by which they are referenced
• A remark describing the attribute (optional)
• A data type
• A default value (optional)
• Nullability
You create attributes for a user class in the Class Editor.
To create attributes for a user class
1. Select the application that contains the user class in the Applications portlet of the Develop tab.
2. Double-click the user class in the Components portlet.
The Class Editor is opened.
3. Click the Attributes tab in the Class Editor.
4. Click Edit, Insert, New.
The Create Attribute dialog appears.
5. Enter a name for the attribute in the Name field (for example, my_attribute).
6. Specify the attribute's data type.
For example, you might select Integer from the Data Type option field.
Note: You cannot create a user class with a name of “int” or “integer.”
7. (Optional) Specify other properties for the attribute, such as Remark, Encapsulation (Private), and Default Value.
Note: The Private option, if selected, specifies that the attribute is private, meaning that it can be accessed only by a method of the current user class or any of its subclasses.
8. Click Create.
The Create Attribute dialog becomes the AttributeProperties dialog.
If you did not specify the properties for the attribute previously, this dialog lets you specify or edit them now.
9. (Optional) Edit the attribute's properties and then click Apply to put your changes into effect.
10. (Optional) Create additional attributes by clicking New and using the previous steps in this procedure.
11. Click Close when you are finished creating attributes.
12. Click File, Save and Close to save your changes and close the Class Editor.
You are returned to the Class Editor where Workbench displays the attributes in the Attributes table field.