Question & Answer
Question
How do you model a java collection class attribute in IBM Rational Software Architect for Websphere Software?
Answer
Note: In a model that is intended to be consumed by a UML to Java transformation, the most direct way to model:
private ArrayList<Address> addresses;
Steps to model a java collection class attribute:
Option #1
- Add an attribute named addresses
- Set the visibility to private
- Set type Address (either the Java class or Address in a UML model)
- Set the multiplicity of the attribute to *
- Add the <<JavaCollection>> stereotype to the attribute to ensure the Java Transformation profile is applied.
- Set "java.util.ArrayList" for the collectionType property on the stereotype.
Option #2
A second option would be to leave out the profile/stereotype and modify the default collection types on the Collections tab in the transformation configuration editor.
Using this approach will limit you to four different types of collections that will be selected based on the isOrdered and isUnique UML properties for the attribute being generated. (Most likely for an ArrayList you would specify isOrdered to be true and isUnique to false and then override the default of "java.util.List" to be "java.util.ArrayList").
Option #3
Support does not recommend this option. Use at own risk. |
---|
A third approach would be to fully model the ArrayList class as a template UML class and use a <<JavaGenericInstance>> stereotyped instance of the template bound to Address to represent the type of the addresses attribute.
[{"Product":{"code":"SS4JCV","label":"Rational Software Architect for WebSphere Software"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Modeling","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"7.5;7.5.1;7.5.2","Edition":"","Line of Business":{"code":"LOB15","label":"Integration"}}]
Was this topic helpful?
Document Information
More support for:
Rational Software Architect for WebSphere Software
Software version:
7.5, 7.5.1, 7.5.2
Operating system(s):
Linux, Windows
Document number:
395717
Modified date:
16 June 2018
UID
swg21398265