'Add another annotation when an annotation is present with Java 8

I am currently creating my own CRUD-managing class. For this purpose I work with an annotation that looks like this:

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface DTO {
    String table() default "";
}

Every object annotated with this annotation also needs to have the "NoArgsConstructor"-Annotation from lombok, which can only be applied to class or enum types. Therefore I cannot just add it on top of the annotations of the definition of DTO. How can I achieve, that every class that has the DTO-Annotation also receives the NoArgsConstructor without it being required to add it every time manually?

This works fine:

@Data
@NoArgsConstructor
@DTO(table = "cast2")
public class CastDTO {
    @Column
    private Integer mid;
    @Column
    private Integer pid;
    @Column
    private String role;
}

but I'd rather not have to add NoArgsConstructor every time I create another Class.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source