-
Notifications
You must be signed in to change notification settings - Fork 2
Qualified association documentation
David Overgaard edited this page Mar 9, 2014
·
5 revisions
Features not currently supported
- Visibility (scope) of generated hash. All generated hashes are private with access methods.
- Value attributes with multiple key attributes
Note: This is currently a two step process until Papyrus is enhanced to fully support qualified associations.
- Value: Add a 'property' (member variable) to a class using either a property or an association to another class.
- Key: Add another property as a sub-property to value.
- From the Model Explorer right-click and select 'New Child -> Create a new Property'
- Define this attribute by selecting it and updating the UML sub-tab of the Properties tab.
- From the Model Explorer window drag and drop the key property onto the UML diagram.
- Place it at the source end of the association as in the UML diagram above.
- Only the value property can be displayed in the class model. To do this drag and drop the value property from the Model Explorer into the related class model property (top) compartment.
Bank.rb
class Bank
public
def initialize()
@customerByAccountNumber = Hash.new
end
def addCustomer(accountNumber, customer)
@customerByAccountNumber[accountNumber] = customer
end
def removeCustomer(accountNumber)
@customerByAccountNumber.delete(accountNumber)
end
def getCustomer(accountNumber)
return @customerByAccountNumber[accountNumber]
end
protected
private
end
Customer.rb
class Customer
public
def initialize()
end
protected
private
end