Java annotation inside annotation Issue

Viewed 444

hi guys is something kinda like this allowed in java:

@Retention(RetentionPolicy.RUNTIME)
@Target(METHOD)
@FirstAnno
public @interface Test1 {
    Test2 t();

    @SecondAnno
    public @interface Test2 {
      // also has @FirstAnno

    }
}

later I use it like this;

class MyClass {

  @Test1.Test2 // or something like this
  public String getData(){
  }
}

is this possible?

1 Answers
Related