1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.struts.chain.contexts;
22
23 import org.apache.commons.chain.Context;
24
25 import java.util.Collection;
26 import java.util.Map;
27 import java.util.Set;
28
29 /**
30 * <p> Provide a base class for any Context Implementation which is primarily
31 * intended for use in a subchain. </p> <p> Classes which extend
32 * <code>ContextWrapper</code> may implement typesafe property methods which
33 * also leave their values in the underlying context. </p>
34 */
35 public class ContextWrapper implements Context {
36 private Context base;
37
38 /**
39 * <p> Instantiate object as a composite around the given Context. </p>
40 *
41 * @param context Context instance to wrap
42 */
43 public ContextWrapper(Context context) {
44 this.base = context;
45 }
46
47 /**
48 * Provide the underlying Context for this composite.
49 *
50 * @return The undelrying Context
51 */
52 protected Context getBaseContext() {
53 return this.base;
54 }
55
56
57
58
59 public Set entrySet() {
60 return this.base.entrySet();
61 }
62
63 public Set keySet() {
64 return this.base.keySet();
65 }
66
67 public Collection values() {
68 return this.base.values();
69 }
70
71 public void clear() {
72 this.base.clear();
73 }
74
75 public void putAll(Map map) {
76
77 this.base.putAll(map);
78 }
79
80 public Object remove(Object key) {
81 return this.base.remove(key);
82 }
83
84 public Object put(Object key, Object value) {
85
86 return this.base.put(key, value);
87 }
88
89 public Object get(Object key) {
90 return this.base.get(key);
91 }
92
93 public boolean containsValue(Object o) {
94 return this.base.containsValue(o);
95 }
96
97 public boolean containsKey(Object o) {
98 return this.base.containsKey(o);
99 }
100
101 public boolean isEmpty() {
102 return this.base.isEmpty();
103 }
104
105 public int size() {
106 return this.base.size();
107 }
108 }