1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public class AnnotationTest {
private Logger log = LoggerFactory.getLogger(this.getClass());
@Test
public void test() throws Exception {
Field f_b = Test1.class.getDeclaredField("b");
Annotation annotation_b = f_b.getAnnotation(Ignore.class);
Field f_a = Test1.class.getDeclaredField("a");
Annotation annotation_a = f_a.getAnnotation(Ignore.class);
log.info("" + annotation_a);
log.info("" + annotation_b);
}
}
class Test1 {
String a;
@Ignore
String b;
}