Attribute Implementation
| Before starting this lab, you must read the chapter Correspondance entre modèles de conception UML et le code: aspects structurels. |
Use Java to implement the UML Class Event and its attributes.
Use the Getter/Setter implementation strategy introduced during the lectures.
|
Open the Maven module named attributes.
Part of the implementation is already done: a Java enumeration named AlarmKind,
a Java interface named Event, and several unit tests (see class SimpleEventTest).
There is also a partial implementation of the class SimpleEvent.
-
First, declare the needed Java fields. All fields must be private.
-
Then, implement the class constructor. Remember that some attributes are mandatory and others are not. The constructor must throw a
IllegalArgumentExceptionif the arguments are invalid. -
After, implement the fields' accessors and modifiers (getters and setters).
-
Run all tests. Once all tests pass, you are finished.