View Javadoc

1   /*
2    * Copyright 2004-2005 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy of
6    * the License at
7    * 
8    * http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package net.sf.morph.context.support;
17  
18  import java.util.Collection;
19  import java.util.Map;
20  import java.util.Set;
21  
22  import net.sf.morph.context.Context;
23  
24  /**
25   * Exposes any context as a Map.
26   * 
27   * @author Matt Sgarlata
28   * @since Nov 22, 2004
29   */
30  public class ContextMap implements Map {
31  
32  	private ContextMapBridge contextMapBridge = new ContextMapBridge();
33  	
34  	private Context context;
35  	
36  	public ContextMap(Context context) {
37  		this.context = context;
38  	}
39  	
40  	public void clear() {
41  		contextMapBridge.clear(context);
42  	}
43  	public boolean containsKey(Object key) {
44  		return contextMapBridge.containsKey(context, key);
45  	}
46  	public boolean containsValue(Object value) {
47  		return contextMapBridge.containsValue(context, value);
48  	}
49  	public Set entrySet() {
50  		return contextMapBridge.entrySet(context);
51  	}
52  	public boolean equals(Object obj) {
53  		return contextMapBridge.equals(obj);
54  	}
55  	public Object get(Object key) {
56  		return contextMapBridge.get(context, key);
57  	}
58  	public int hashCode() {
59  		return contextMapBridge.hashCode();
60  	}
61  	public boolean isEmpty() {
62  		return contextMapBridge.isEmpty(context);
63  	}
64  	public Set keySet() {
65  		return contextMapBridge.keySet(context);
66  	}
67  	public Object put(Object key, Object value) {
68  		return contextMapBridge.put(context, key, value);
69  	}
70  	public void putAll(Map t) {
71  		contextMapBridge.putAll(context, t);
72  	}
73  	public Object remove(Object key) {
74  		return contextMapBridge.remove(context, key);
75  	}
76  	public int size() {
77  		return contextMapBridge.size(context);
78  	}
79  	public String toString() {
80  		return contextMapBridge.toString();
81  	}
82  	public Collection values() {
83  		return contextMapBridge.values(context);
84  	}
85  
86  	public Context getContext() {
87  		return context;
88  	}
89  	public void setContext(Context context) {
90  		this.context = context;
91  	}
92  	public ContextMapBridge getContextMapBridge() {
93  		return contextMapBridge;
94  	}
95  	public void setContextMapBridge(ContextMapBridge contextMapBridge) {
96  		this.contextMapBridge = contextMapBridge;
97  	}
98  	
99  }