Jin*_*won 4 java reflection annotations
假设我有一个注释。
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MyAnnotation {
int value() default 1;
}
Run Code Online (Sandbox Code Playgroud)
有什么方法可以获取1使用反射之类的价值吗?
怎么样
MyAnnotation.class.getMethod("value").getDefaultValue()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2242 次 |
| 最近记录: |