【发布时间】:2021-05-13 08:00:20
【问题描述】:
请告诉我,如何获取泛型类型的注释?
示例:我有public List<@NotNull GuestForm> guests,我想获得 NotNull 注释。
public class BookingForm {
public List<@NotNull GuestForm> guests;
private List<String> amenities;
private String propertyType;
private Unrelated unrelated;
public BookingForm(List<GuestForm> guests, List<String> amenities, String propertyType, Unrelated unrelated) {
this.guests = guests;
this.amenities = amenities;
this.propertyType = propertyType;
this.unrelated = unrelated;
}
}
【问题讨论】:
-
你想要什么?你能说得清楚一点吗?
-
我想得到一个 List 中声明的所有注解的列表
标签: java reflection java-annotations