现有注解如下:
package anno;
/**
* Created by adinlead on 17-5-22.
*/
public @interface NoNull {
boolean fields() default true;
}
方法如下:
package controllers;
import anno.NoNull;
/**
* Created by adinlead on 17-5-22.
*/
public class Test {
public static void test(@NoNull String str) {
if (str == null){
System.out.println("拦截失败");
}
System.out.println("拦截成功");
}
}
在框架调用test之前,我可以手动写个方法来检查
我想在检查中获取test方法的参数是否带有@NoNull注解
应该怎么做?