Java Patterns
Presentation
Java Patterns provide solutions to problems that all Java developers have come across. In addition, the automation they provide also considerably reduces the risk of errors or omissions.
The use of patterns allows you to focus on the part of your application that is specific to your domain, and avoids having to deal with problems for which a proven generic solution exists, at a lower level.
Remote Method Invocation
Calling methods on remote objects is a powerful service provided by Java. Having to code not only the concrete class but also the interface means doing the same task twice, and entails a further risk of errors.
These risks no longer exist with the "RMI" pattern. In addition, the "RMI" pattern is incremental, meaning that it can be applied each time the concrete class is modified.
Sending events
It often happens in a Java application that the user wants to trigger an event when the state of an object changes or when it is found in a specific state.
The "Sending events" pattern creates the event class and the interface for the objects that will listen. It also manages notifications.
Listening to events
It is almost impossible to write a Java application without listening to events, such as clicking on a button, selecting a text field or moving a gauge.
The "Listening to events" pattern is used to find out when events will occur ("subscribing" to events), and to create internal classes which will manage the listening, as well as methods used to answer notifications.
Creating methods to be implemented
Launching
the "Create
methods to be implemented" pattern on a class has the effect of recursively
scanning the implemented interface classes collecting their methods. These methods are then created in the class. This process is carried out for each class of
the package.
The processing only takes into account the modeled interfaces and not the {JavaImplements} tagged values.
Creating methods to be redefined
Launching the "Create methods to be redefined" pattern on a class has the effect of going recursively through the parent classes collecting their abstract methods. These methods are then created in the class. This process is carried out for each class of the package.
Transforming a class into a non-primitive class
The "Transform a class into a non-primitive class" pattern is especially useful for reversed classes. The reverse only produces primitive classes. If a user wishes to make a reversed class non-primitive, especially to create associations towards this class, he can use this pattern which will have the effect of transforming the attributes with this type into associations.
Transforming a class into a primitive class
The "Transform
a class into a primitive class"
pattern is the same as the previous operation in the other direction. Its effect is to transform the associations towards this class into
attributes.