1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| package org.apache.tapestry.annotations; |
16 |
| |
17 |
| import java.lang.reflect.Method; |
18 |
| |
19 |
| import org.apache.tapestry.enhance.EnhancementOperation; |
20 |
| import org.apache.tapestry.enhance.InjectObjectWorker; |
21 |
| import org.apache.tapestry.services.InjectedValueProvider; |
22 |
| import org.apache.tapestry.spec.IComponentSpecification; |
23 |
| |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| |
33 |
| |
34 |
| public class InjectObjectAnnotationWorker implements MethodAnnotationEnhancementWorker |
35 |
| { |
36 |
| final InjectObjectWorker _delegate; |
37 |
| |
38 |
1
| public InjectObjectAnnotationWorker()
|
39 |
| { |
40 |
1
| this(new InjectObjectWorker());
|
41 |
| } |
42 |
| |
43 |
2
| InjectObjectAnnotationWorker(InjectObjectWorker delegate)
|
44 |
| { |
45 |
2
| _delegate = delegate;
|
46 |
| } |
47 |
| |
48 |
1
| public void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
|
49 |
| Method method) |
50 |
| { |
51 |
1
| InjectObject io = method.getAnnotation(InjectObject.class);
|
52 |
| |
53 |
1
| String object = io.value();
|
54 |
| |
55 |
1
| String propertyName = AnnotationUtils.getPropertyName(method);
|
56 |
| |
57 |
1
| _delegate.injectObject(op, object, propertyName, null);
|
58 |
| } |
59 |
| |
60 |
1
| public void setProvider(InjectedValueProvider provider)
|
61 |
| { |
62 |
1
| _delegate.setProvider(provider);
|
63 |
| } |
64 |
| } |