01: //$Id: MapProxy.java 9210 2006-02-03 22:15:19Z steveebersole $
02: package org.hibernate.proxy.map;
03:
04: import org.hibernate.proxy.map.MapLazyInitializer;
05: import org.hibernate.proxy.HibernateProxy;
06: import org.hibernate.proxy.LazyInitializer;
07:
08: import java.io.Serializable;
09: import java.util.Collection;
10: import java.util.Map;
11: import java.util.Set;
12:
13: /**
14: * Proxy for "dynamic-map" entity representations.
15: *
16: * @author Gavin King
17: */
18: public class MapProxy implements HibernateProxy, Map, Serializable {
19:
20: private MapLazyInitializer li;
21:
22: MapProxy(MapLazyInitializer li) {
23: this .li = li;
24: }
25:
26: public Object writeReplace() {
27: return this ;
28: }
29:
30: public LazyInitializer getHibernateLazyInitializer() {
31: return li;
32: }
33:
34: public int size() {
35: return li.getMap().size();
36: }
37:
38: public void clear() {
39: li.getMap().clear();
40: }
41:
42: public boolean isEmpty() {
43: return li.getMap().isEmpty();
44: }
45:
46: public boolean containsKey(Object key) {
47: return li.getMap().containsKey(key);
48: }
49:
50: public boolean containsValue(Object value) {
51: return li.getMap().containsValue(value);
52: }
53:
54: public Collection values() {
55: return li.getMap().values();
56: }
57:
58: public void putAll(Map t) {
59: li.getMap().putAll(t);
60: }
61:
62: public Set entrySet() {
63: return li.getMap().entrySet();
64: }
65:
66: public Set keySet() {
67: return li.getMap().keySet();
68: }
69:
70: public Object get(Object key) {
71: return li.getMap().get(key);
72: }
73:
74: public Object remove(Object key) {
75: return li.getMap().remove(key);
76: }
77:
78: public Object put(Object key, Object value) {
79: return li.getMap().put(key, value);
80: }
81:
82: }
|