Java中的Annotation(注解)@

基本内置注解

@Override

@Deprecated

获取注解信息

Method[] method=HomeAction.class.getMethods();
for(Method m:method){
    Annotation[] annotation=m.getAnnotations();
    if(annotation.length>0)
        for(Annotation a:annotation)
          System.out.println(a.annotationType().getSimpleName());
}    

XDoclet是一开源的项目,用来获取注解信息及生成一些配置文件。

原文地址:https://www.cnblogs.com/angelshelter/p/2748528.html