This project has retired. For details please refer to its
Attic page.
NestedObjectDelegatePropertyAccessor xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.apache.tiles.ognl;
23
24 import java.util.Map;
25
26 import ognl.OgnlContext;
27 import ognl.OgnlException;
28 import ognl.PropertyAccessor;
29
30
31
32
33
34
35
36
37
38
39 public class NestedObjectDelegatePropertyAccessor<T> implements
40 PropertyAccessor {
41
42
43
44
45
46
47 private NestedObjectExtractor<T> nestedObjectExtractor;
48
49
50
51
52
53
54 private PropertyAccessor propertyAccessor;
55
56
57
58
59
60
61
62
63 public NestedObjectDelegatePropertyAccessor(
64 NestedObjectExtractor<T> nestedObjectExtractor,
65 PropertyAccessor propertyAccessor) {
66 this.nestedObjectExtractor = nestedObjectExtractor;
67 this.propertyAccessor = propertyAccessor;
68 }
69
70
71 @SuppressWarnings("unchecked")
72 public Object getProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name)
73 throws OgnlException {
74 return propertyAccessor.getProperty(context, nestedObjectExtractor
75 .getNestedObject((T) target), name);
76 }
77
78
79 @SuppressWarnings("unchecked")
80 public void setProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name,
81 Object value) throws OgnlException {
82 propertyAccessor.setProperty(context, nestedObjectExtractor
83 .getNestedObject((T) target), name, value);
84 }
85
86
87 @SuppressWarnings("unchecked")
88 public String getSourceAccessor(OgnlContext context, Object target,
89 Object index) {
90 return propertyAccessor.getSourceAccessor(context,
91 nestedObjectExtractor.getNestedObject((T) target), index);
92 }
93
94
95 @SuppressWarnings("unchecked")
96 public String getSourceSetter(OgnlContext context, Object target,
97 Object index) {
98 return propertyAccessor.getSourceSetter(context, nestedObjectExtractor
99 .getNestedObject((T) target), index);
100 }
101 }