I want to define my own annotation for transfer objects and include there some Lombok annotations as meta-annotations:
@Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @Data @NoArgsConstructor @AllArgsConstructor public @interface TransferObject { }
The intent is to annotate all my transfer objects with @TransferObject
and "inherit" all of the above. In practice it doesn't work, classes annotated with @TransferObject
are not processed by Lombok.
Is there some way to get this working? If not, it it theoretically possible to enhance Lombok to look for meta-annotations?
Note: I'm on Java 8.
UPDATE: It looks like there's a feature request for this on github.
The rows or tuples are the data, and the columns would be the metadata; they define what each value is for any given row. Annotations are code snippits you put in at the java class or method level that further define data about the given code, but without changing any of the actual coded logic.
What is Lombok. Project Lombok (from now on, Lombok) is an annotation-based Java library that allows you to reduce boilerplate code. Lombok offers various annotations aimed at replacing Java code that is well known for being boilerplate, repetitive, or tedious to write.
Notice the @interface keyword. This signals to the Java compiler that this is a Java annotation definition. Notice that each element is defined similarly to a method definition in an interface. It has a data type and a name.
Short answer is NOT (for current version 1.18.4 - Oct 30, 2018)
According to the thread here:
This feature would require resolution in a very early stage of processing. Currently that is not possible. Possibly, since we now have the lombok configuration system, we might come up with a different solution.
Actually, they have several requests of the similar functionality on Lombok's GitHub page - non of them is implemented.
Please consider upvoting this feature or this one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With