01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.faces.context;
18:
19: import java.util.Map;
20: import java.util.Set;
21:
22: /**
23: * Base class for JSF context maps
24: *
25: * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
26: * @version CVS $Id: BaseMap.java 433543 2006-08-22 06:22:54Z crossley $
27: */
28: abstract class BaseMap extends java.util.AbstractMap {
29:
30: static class Entry implements Map.Entry {
31: private final Object key;
32: private final Object value;
33:
34: Entry(Object key, Object value) {
35: this .key = key;
36: this .value = value;
37: }
38:
39: public Object getKey() {
40: return key;
41: }
42:
43: public Object getValue() {
44: return value;
45: }
46:
47: public Object setValue(Object value) {
48: throw new UnsupportedOperationException();
49: }
50:
51: public int hashCode() {
52: return (key != null ? key.hashCode() : 0)
53: ^ (value != null ? value.hashCode() : 0);
54: }
55:
56: public boolean equals(Object obj) {
57: if (obj == null || !(obj instanceof Map.Entry)) {
58: return false;
59: }
60:
61: Map.Entry other = (Map.Entry) obj;
62: Object key = other.getKey();
63: if (key == this .key || key != null && key.equals(this .key)) {
64: Object value = other.getValue();
65: return value == this .value || value != null
66: && value.equals(this .value);
67: }
68: return false;
69: }
70: }
71:
72: BaseMap() {
73: }
74:
75: public void clear() {
76: throw new UnsupportedOperationException();
77: }
78:
79: public void putAll(Map t) {
80: throw new UnsupportedOperationException();
81: }
82:
83: public Object remove(Object key) {
84: throw new UnsupportedOperationException();
85: }
86:
87: public Set entrySet() {
88: throw new UnsupportedOperationException();
89: }
90: }
|