I have an annotation with 3 attributes:
public @interface Date {
    int day() default 1;
    int month() default 1;
    int year() default 2000;
}
And annotation that uses previous annotation as attribute:
public @interface Author {
    String name();
    Date date(); //default value here
}
How to set default value for attribute date?
You do this by providing a default annotaion...
For example:
public @interface Author {
    String name();
    Date date() default @Date(year=2014);
}
                        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