A Note on the UML Diagrams Used in This Book


In this book, Universal Modeling Language (UML) class diagrams are used to introduce the various classes and interfaces of JDO that are important to the application programmer. The standard UML class diagram consists of three boxes.

The top box contains the class name. The middle box contains the attributes of the class. These are the static or member variables of the class. The bottom box contains the operations of the class. When an interface is diagrammed, the top box typically contains the string "<<Interface>>" to identify that the diagram's subject is an interface.

In this book, the standard UML class diagram has been modified to provide more information. Instead of three boxes, the UML class diagrams used in this book have four boxes.

click to expand

The top box contains, as before, the class name. The box has been expanded to include a line for the name of the class that the diagrammed class extends (if other than Object) and a second line for the interfaces that the class implements. For the JDO classes and interfaces presented in this book, there are no attributes of interest. For that reason, the box is present but looks more like a double line.

The third box contains, as before, the operations of the class. In this book, the only operations examined are public. An annotation is used to indicate when the operation is overloaded. When the operation is followed by the plus sign ("+"), there are more parameter signatures than the one shown. This annotation is used to keep the UML class diagrams as brief as possible.

At the bottom of the UML diagram, a fourth box is introduced where JavaBean-conforming properties are listed. JavaBean properties are methods that generally come in get/set pairs and are backed by a private attribute in the implementation. The getter method returns a reference or primitive of a particular type and the setter method uses one parameter of that return type. So, for example, the method pair

 public int getCount() public void setCount(int num) 

defines the JavaBean property Count for the class. Boolean properties can be a little bit different, because the "get" method may be an "is" method instead. For example, the method pair

 public boolean isFast() public void setFast(boolean flag) 

defines the Boolean property Fast.

Because JavaBean properties are well understood, it is briefer and clearer to have one entry in the UML properties box rather than two entries in the operations box. For example, four operations are required in the operations box to indicate the two properties Count and Fast:

 getCount: int setCount(num: int): void isFast: boolean setFast(flag: boolean): void 

On the other hand, to represent the same information in the properties box requires only two entries:

 Count: int Fast: boolean 

If the property name is the same as the type that the property returns, then the return type is omitted. For example, the entry "Synchronization" in the property box indicates that there are two methods in the class:

 public Synchronization getSynchronization(); public void setSynchronization(Synchronization sync); 

Not all JavaBean properties are read/write. Some are write-only, and some are read-only. In these cases, the corresponding getter method or setter method is not provided in the class. In this book, to indicate a read-only property, the UML property entry is followed by a minus sign, as in the following property entry: "Initialized: boolean –". A write-only property is indicated by a plus sign at the end of the property entry.




Using and Understanding Java Data Objects
Using and Understanding Java Data Objects
ISBN: 1590590430
EAN: 2147483647
Year: 2005
Pages: 156
Authors: David Ezzio

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net