Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do any Java libraries use annotations for code generation?

Is anyone aware of a library that uses the the techniques (annotations and classworking) described in this article for automatically generating the standard Object methods toString(), equals() and hashcode() for standard java classes?

like image 997
Ben Avatar asked Jul 23 '09 08:07

Ben


People also ask

Which Java annotation is used to add data about code?

Java annotations are metadata (data about data) for our program source code. They provide additional information about the program to the compiler but are not part of the program itself. These annotations do not affect the execution of the compiled program. Let's take an example of @Override annotation.

Do Java annotations do anything?

Java annotations are used to provide meta data for your Java code. Being meta data, Java annotations do not directly affect the execution of your code, although some types of annotations can actually be used for that purpose.


1 Answers

Yes, project Lombok does this. See http://projectlombok.org . It not only supports javac, but also Eclipse. So the methods are not in the source code, but are displayed in the outline view.

like image 139
Benno Richters Avatar answered Sep 29 '22 14:09

Benno Richters