I would like to generate tables from annotated objects. Right now I have the following schema in mind. I would like to annotate the object as follows:
@UI.App(
name = "locations",
columns = {
@UI.Presenter.PropertyColumn("title"),
@UI.Presenter.PropertyColumn("enabled"),
@UI.Presenter.StatusColumn,
@UI.Presenter.LastModifiedColumn
}
)
public class Location {
private String title;
private Boolean enabled;
}
For that I intended to use the following annotations
public interface UI {
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE})
public @interface App {
public String name();
public Presenter.Column[] columns() default {};
}
public interface Presenter {
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE})
public @interface Column {}
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE})
public @interface PropertyColumn {
public String value();
public boolean editable() default false;
}
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE})
public @interface StatusColumn {}
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE})
public @interface LastModifiedColumn {}
}
}
With annotation inheritance I would just let PropertyColumn, StatusColumn, and LastModifiedColumn to extend the Column interface. But there's no interface inheritance.
The main goal here is to have the overview annotation as concise as possible. What is the best way to achieve my goal?