1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.grouplens.grapht.reflect.internal.types;
21
22 import org.grouplens.grapht.reflect.InjectionPoint;
23 import org.grouplens.grapht.reflect.internal.ConstructorParameterInjectionPoint;
24 import org.grouplens.grapht.reflect.internal.SetterInjectionPoint;
25
26 import javax.inject.Inject;
27
28 public class TypeC {
29 public static final InjectionPoint CONSTRUCTOR;
30 public static final InjectionPoint INTERFACE_A;
31 public static final InjectionPoint TYPE_A;
32 public static final InjectionPoint INTERFACE_B;
33 public static final InjectionPoint TYPE_B;
34
35 static {
36 try {
37 CONSTRUCTOR = new ConstructorParameterInjectionPoint(TypeC.class.getConstructor(int.class), 0);
38 INTERFACE_A = new SetterInjectionPoint(TypeC.class.getMethod("setRoleA", InterfaceA.class), 0);
39 TYPE_A = new SetterInjectionPoint(TypeC.class.getMethod("setTypeA", TypeA.class), 0);
40 INTERFACE_B = new SetterInjectionPoint(TypeC.class.getMethod("setRoleD", InterfaceB.class), 0);
41 TYPE_B = new SetterInjectionPoint(TypeC.class.getMethod("setTypeB", TypeB.class), 0);
42 } catch(Exception e) {
43 throw new RuntimeException(e);
44 }
45 }
46
47 private final int value;
48 private InterfaceA a1;
49 private TypeA a2;
50 private InterfaceB b1;
51 private TypeB b2;
52
53 @Inject
54 public TypeC(@ParameterA int intValue) {
55
56 value = intValue;
57 }
58
59 @Inject
60 public void setRoleA(@RoleA InterfaceA a) {
61
62
63 a1 = a;
64 }
65
66 @Inject
67 public void setTypeA(TypeA a) {
68
69 a2 = a;
70 }
71
72 @Inject
73 public void setRoleD(@RoleD InterfaceB b) {
74
75 b1 = b;
76 }
77
78 @Inject
79 public void setTypeB(TypeB b) {
80
81 b2 = b;
82 }
83
84 public TypeB getTypeB() {
85 return b2;
86 }
87
88 public InterfaceB getInterfaceB() {
89 return b1;
90 }
91
92 public int getIntValue() {
93 return value;
94 }
95
96 public InterfaceA getInterfaceA() {
97 return a1;
98 }
99
100 public TypeA getTypeA() {
101 return a2;
102 }
103 }