我见过几个使用自定义注释的例子.例
@SimpleAnnotation
class SampleBean {
@SimpleAnnotation
public String getName() {
return "AAA";
}
public void setName(String name) {
}
public int getHeight() {
return 201;
}
}
@Target( { ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@interface SimpleAnnotation {
}
Run Code Online (Sandbox Code Playgroud)
有人能说出我们为什么使用这个吗?