The BCI has decided to cater to its customers, long interested in this form of trade but reluctant to make large investments. By exploiting the new opportunities provided by the software developed with the Open Source philosophy, we have found some solutions at the forefront and, surprisingly, often exploited by some of the greatest leaders in the industry. |
| Write less code with Java Lombok |
|
|
|
|
Reduce the lines of code for the implementation of a program is a desire of almost all developers, regardless of the language used. To this end, we report for the Java project worthy of note, who has received the attention of developerWorks, IBM's Lombok. Like almost all projects Java, Lombok is physically include a JAR archive in the projects should be used, but it is easily integrated with Eclipse, thanks to the wizard included in the same JAR. To work Lombok uses custom annotation. The most powerful and safe annotation @ Data, which includes in itself the operations of other annotation of Lombok:
So a file POJO can be written as follows:
Once built it, what is created is as shown in disassembler javap:
This default configuration can be changed: for example we can change something in the behavior of toString () excluding one variable at our option.
Other features of interest are: the annotation @ Cleanup to avoid writing the try / catch and the various close () required in the finally block; @ sychronized, used, as can be imagined, for the definition of protected methods note directly from the same name; and finally @ SneakyThrows, which avoids the use of the directive throws. |














