This is not a tree structure, but only a linear list. Try using an array to simplify the declaration.
@Retention(RetentionPolicy.RUNTIME) public @interface MyNode { String name(); }
And wrap:
@Retention(RetentionPolicy.RUNTIME) public @interface MyNodes { MyNode[] value(); }
Now just declare an array:
@MyNodes({ @MyNode(name = "name1"), @MyNode(name = "name2") }) public class MyClass { }
source share