UML Designer User's Guide


Defining a message manually

Suppose we now decide we want to add getter and setter messages to <CatalogEntry> for storing the Dewey number. We could go back and define this as a responsibility of the Catalog Entry Thing and regenerate the protocol, but let's try directly adding the responsibility to the protocol.

To add the new messages, follow these steps:

  1. Select Protocols in the Relationships Browser.
  2. Select <CatalogEntry> from the list of protocols.
  3. Select New>Message Specification from the pop-up menu of <CatalogEntry>.
  4. When prompted for the message specification, type the following (be sure to include spaces on either side of the colon):
    deweyNumber : <String>
    
    This is the formal UML syntax declaring a message specification. It indicates a unary message with no parameters that returns an object of type <String>. This is the getter message for the deweyNumber attribute.
  5. Use New>Message Specification again to add the setter message for the deweyNumber attribute:
    deweyNumber: (number: <String>): <String>
    
    This is the UML syntax declaring a unary message taking one parameter of type <String> and returning a <String>.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]