The following stereotypes of UML classes and data types are mapped to J2SE objects as below:
| UML | OGC Purpose | Java mapping |
|---|---|---|
<<DataType>> |
A descriptor of a set of values that lack identity (independent existence and the possibility of side effects). A DataType is a class with no operations whose primary purpose is to hold the information. | Interface |
<<CodeList>> |
A flexible enumeration that uses string values for expressing a list of potential values. | CodeList extends
java.lang.Enum* |
<<Union>> |
Contains a list of attributes where only one of those attributes can be present at any time. | none |
<<Abstract>> |
A polymorphic object class that cannot be instantiated. | Interface |
| Constructor | Cast an object into an object of an other type. | A createFoo() method in a Factory interface. |
Set<DataType> |
A finite set. Each object is considered to be in the set only once. | java.util.Set |
Sequence<DataType> |
A sequence type of collection, which contains an ordered finite list of values (possibly with repeated values) of the specified data type. | Small array, or
java.util.List
if the sequence is likely to be big. |
CharacterString |
A sequence of characters. | java.lang.String
in the general case, or
java.net.URL
for reference to a file. |
Integer |
An integer number. | int |
Double |
A double precision floating point number. | double |
Boolean |
A value specifying TRUE or FALSE. | boolean |
Sign |
Sign + or -. | int with value +1 ou -1 |
DateTime |
A character string as specified by ISO 19108, which comprises year, month, day and time of the day to the appropriate level of precision. | java.util.Date |
Scale |
A floating point number associated with a dimensionless unit. | double |
Length |
A floating point number associated with a linear unit. | double with some getUnit() method
(e.g. getAxisUnit()). |
Angle |
A floating point number associated with an angular unit. | double with some getUnit() method
(e.g. getAngularUnit()). |
Measure |
A floating point number associated with an arbitrary unit. | double with a getUnit() method. |
* For platform earlier than J2SE 1.5, the CodeList
class will defines the same attributes than Enum but will not
extends Enum.
OpenGIS's Mandatory, Conditional and
Optional attributes are marked using custom @UML mandatory,
@UML conditional and @UML optional javadoc tags respectively.
Additional javadoc tags include @UML association and @UML datatype.
All the above-cited tags imply some renaming rules in order to comply with Java
naming conventions.
| Javadoc tag | Usage and renaming rule |
|---|---|
@UML datatype |
Interfaces marked with this tag are "datatype" (as opposed to "abstract") in UML diagrams. |
@UML mandatory |
The Java method maps to a mandatory attribute in the
UML diagram. The Java method name is prefixed by " |
@UML conditional |
The Java method maps to a conditional attribute in the
UML diagram. The Java method name is prefixed by " |
@UML optional |
The Java method maps to an optional attribute in the
UML diagram. The Java method name is prefixed by " |
@UML association |
The Java method maps to an association in the UML diagram.
The UML's " |
@rename <reason> |
Some other name change has been applied in order to match
more closely Java usage. A description of the change and its rational shall
follow the
|
@unitof <quantity> |
The method returns a |
@revisit <comment> |
Somme open issue to revisit. |