Emitter class transformations

 

Transformation of the emitter class

The following elements are added to the emitter class:

·         an instance association towards the interface described above.  This will allow an instance of the class to find out which objects have subscribed to the events produced by the modifications of the attribute or association value.

·         the attribute's or association's mutators and accessors.  It is important to note that compared to what a standard generation would have produced, mutators are enriched by the notification of an event that can be produced by an association or an attribute.  The user may have to modify the body of these mutators to add conditions to the calling of these notifications.

·         a {JavaNoAccessor} tagged value on the attribute or association notifying the generator that it should not generate accessors, since the pattern has already created them.

·         a method of notification by event that notifies all the subscribers to the events with this type and belonging to the current instance that an event occurred.  The method's name is obtained by concatenating the "notify" string with the name of the event, the first letter of which is put into upper case if required.

·         a method which allows an object to subscribe to the events with the corresponding type on the current instance.  The method's name is obtained by concatenating the "add" string with the name of the event class, the first letter of which is put into upper case if required, and with the "Listener" string"

·         a method which allows an object to be removed from the list of subscribers to the events with the corresponding type of the current instance.  The method's name is obtained by concatenating the "remove" string with the event class name, the first letter of which is put in upper case if required, and with the "Listener" string".