2
我想从注释对象中生成表。现在我有以下模式。我想注释对象如下:Java注释“继承”
@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;
}
为此,我打算用以下注释
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 {}
}
}
随着注释继承我只想让PropertyColumn,StatusColumn和LastModifiedColumn延长列接口。但是没有接口继承。
这里的主要目标是尽可能简要地概述注释。什么是实现我的目标的最佳方式?