1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package jakarta.faces.component;
20
21 import java.io.Serializable;
22 import java.util.Collection;
23 import java.util.Map;
24 import java.util.Set;
25
26 class _ViewAttributeMap implements Map<String, Object>, Serializable
27 {
28 private static final long serialVersionUID = -9106832109394257866L;
29
30 private static final String RESET_SAVE_STATE_MODE_KEY =
31 "oam.view.resetSaveStateMode";
32
33
34
35
36
37 private static final String RESOURCE_DEPENDENCY_UNIQUE_ID_KEY =
38 "oam.view.resourceDependencyUniqueId";
39 private static final String UNIQUE_ID_COUNTER_KEY =
40 "oam.view.uniqueIdCounter";
41
42 private Map<String, Object> _delegate;
43 private UIViewRoot _root;
44
45 public _ViewAttributeMap(UIViewRoot root, Map<String, Object> delegate)
46 {
47 this._delegate = delegate;
48 this._root = root;
49 }
50
51 public int size()
52 {
53 return _delegate.size();
54 }
55
56 public boolean isEmpty()
57 {
58 return _delegate.isEmpty();
59 }
60
61 public boolean containsKey(Object key)
62 {
63 return _delegate.containsKey(key);
64 }
65
66 public boolean containsValue(Object value)
67 {
68 return _delegate.containsValue(value);
69 }
70
71 public Object get(Object key)
72 {
73 checkKey(key);
74 int keyLength = ((String)key).length();
75
76 if (RESET_SAVE_STATE_MODE_KEY.length() == keyLength
77 && RESET_SAVE_STATE_MODE_KEY.equals(key))
78 {
79 return _root.getResetSaveStateMode();
80 }
81 if (RESOURCE_DEPENDENCY_UNIQUE_ID_KEY.length() == keyLength
82 && RESOURCE_DEPENDENCY_UNIQUE_ID_KEY.equals(key))
83 {
84 return _root.isResourceDependencyUniqueId();
85 }
86 if (UNIQUE_ID_COUNTER_KEY.length() == keyLength
87 && UNIQUE_ID_COUNTER_KEY.equals(key))
88 {
89 return _root.getStateHelper().get(UIViewRoot.PropertyKeys.uniqueIdCounter);
90 }
91 return _delegate.get(key);
92 }
93
94 public Object put(String key, Object value)
95 {
96 int keyLength = ((String)key).length();
97
98 if (RESET_SAVE_STATE_MODE_KEY.length() == keyLength
99 && RESET_SAVE_STATE_MODE_KEY.equals(key))
100 {
101 Integer b = _root.getResetSaveStateMode();
102 _root.setResetSaveStateMode(value == null ? 0 : (Integer) value);
103 return b;
104 }
105 if (RESOURCE_DEPENDENCY_UNIQUE_ID_KEY.length() == keyLength
106 && RESOURCE_DEPENDENCY_UNIQUE_ID_KEY.equals(key))
107 {
108 boolean b = _root.isResourceDependencyUniqueId();
109 _root.setResourceDependencyUniqueId(value == null ? false : (Boolean) value);
110 return b;
111 }
112 if (UNIQUE_ID_COUNTER_KEY.length() == keyLength
113 && UNIQUE_ID_COUNTER_KEY.equals(key))
114 {
115 Integer v = (Integer) _root.getStateHelper().get(UIViewRoot.PropertyKeys.uniqueIdCounter);
116 _root.getStateHelper().put(UIViewRoot.PropertyKeys.uniqueIdCounter, value);
117 return v;
118 }
119 return _delegate.put(key, value);
120 }
121
122 public Object remove(Object key)
123 {
124 return _delegate.remove(key);
125 }
126
127 public void putAll(Map<? extends String, ? extends Object> m)
128 {
129 _delegate.putAll(m);
130 }
131
132 public void clear()
133 {
134 _delegate.clear();
135 }
136
137 public Set<String> keySet()
138 {
139 return _delegate.keySet();
140 }
141
142 public Collection<Object> values()
143 {
144 return _delegate.values();
145 }
146
147 public Set<Entry<String, Object>> entrySet()
148 {
149 return _delegate.entrySet();
150 }
151
152 public boolean equals(Object o)
153 {
154 return _delegate.equals(o);
155 }
156
157 public int hashCode()
158 {
159 return _delegate.hashCode();
160 }
161
162 public String toString()
163 {
164 return _delegate.toString();
165 }
166
167 private void checkKey(Object key)
168 {
169 if (key == null)
170 {
171 throw new NullPointerException("key");
172 }
173 if (!(key instanceof String))
174 {
175 throw new ClassCastException("key is not a String");
176 }
177 }
178 }