Creating and Editing Properties

To add a property member to a class element, right-click on the class and select New > Property. The location of the newly created property on the diagram depends on whether or not the Java Beans Properties Support option in the Together modeling preferences is on or off.

Together recognizes Java Bean properties by default. With this support activated, the property displays in the properties compartment on the class, and the class displays as a bean icon. If this option is off, the property displays in the attributes section of the class, and its accessor methods display in the operations section of the class.

To activate or deactivate Java Beans:

  1. From the menubar select, Window > Preferences. The Preferences dialog displays.


  2. In the options list, expand the Modeling node, and select Java.


  3. Check (or uncheck) the options listed under Java Bean Properties Support.

When the option is off, you should take special care when editing or deleting properties. If you edit the property type using the in-place editor, the relevant types in the accessor methods will not be synchronized. The same result occurs when a property is deleted; that is, the accessor methods stay in place and should be deleted individually.

When the Java Beans Properties Support is activated, using cut, copy, paste, clone, or delete commands on a property member, copies (or deletes) not only the property attribute, but also the getters and setters.

 

Related Topic:

Java Preferences