ibm Rational Rhapsody 7.5 — Creating Java enums with the Rational Rhapsody API

Java enums Note Rational Rhapsody does not support the definition of anonymous classes that extend enum constants. Adding Java enums to an object model diagram To add a Java enum to an object model diagram, drag the enum from the browser to the diagram. Code generation Rational Rhapsody generates Java code for the enums you have defined. The reverse engineering feature does not support Java enums. Creating Java enums with the Rational Rhapsody API The following lines of code will add a new enum to the selected package, and define two constants for the new enum:

Dim p As RPPackage Dim c As RPClass Dim a1 As RPAttribute Dim a2 As RPAttribute Set p = getSelectedElement Set c = p.addNewAggr("Enum", "SampleEnum") Set a1 = c.addNewAggr("EnumValue", "FIRST_CONSTANT") Set a2 = c.addNewAggr("EnumValue", "SECOND_CONSTANT") Rational Rhapsody 121