假设我有这个注释:
@Target(METHOD)
@Retention(RUNTIME)
public @interface LifeTime {
long minutes();
long seconds();
}
有没有办法检索使用ElementType
类定义的Annotation
枚举?
Annotation[] annotations = method.getDeclaredAnnotations();
for (Annotation annotation: annotations) {
if (annotation.WHAT? == ElementType.ANNOTATION_TYPE) {
}
}
感谢。