1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.onami.factoryannotation.impl;
20
21 import org.apache.onami.factoryannotation.FactoryAnnotationProvider;
22 import org.apache.onami.factoryannotation.annotations.User;
23
24 import com.google.inject.Inject;
25 import com.google.inject.name.Named;
26
27 public class InjectedUserValueInjector
28 implements FactoryAnnotationProvider<UserEntity, User>
29 {
30
31 @Inject
32 @Named( "test1" )
33 private UserEntity userEntity1;
34
35 @Inject
36 @Named( "test2" )
37 private UserEntity userEntity2;
38
39 public Class<UserEntity> getInjectionType()
40 {
41 return UserEntity.class;
42 }
43
44 public UserEntity buildValue( final User annotation )
45 {
46 if ( annotation.byId() == 1 )
47 {
48 return userEntity1;
49 }
50
51 if ( annotation.byId() == 2 )
52 {
53 return userEntity2;
54 }
55
56 return null;
57 }
58
59 }