summaryrefslogtreecommitdiffstats
path: root/src/test/TestAnnotationsEclipse.java
blob: 42a06c05e57cd102d8da77bc7b60cea2bd33b4de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package test;

import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public class TestAnnotationsEclipse {

	public String a;

	@Retention(RetentionPolicy.CLASS)
	@interface MyAnnotation {}

	public static void main(String[] args) {
	
		TestInner a = new TestAnnotationsEclipse().new TestInner();
		
		for(Constructor mt : a.getClass().getConstructors()) {

			Annotation[][] ann = mt.getParameterAnnotations();
		
			System.out.println(ann.length);
		}		
	}
	
	protected class TestInner {

		public TestInner() {}
		
		public TestInner(String param1, Object param2, @MyAnnotation boolean param3) {
			System.out.println(param1);
			System.out.println(param2);
			System.out.println(param3);
		}

		public void accessField() {
			System.out.println(TestAnnotationsEclipse.this.a);
		}
	}
}