KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > faces > context > BaseMap


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of 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,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.faces.context;
17
18 import java.util.Map JavaDoc;
19 import java.util.Set JavaDoc;
20
21 /**
22  * Base class for JSF context maps
23  *
24  * @author <a HREF="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
25  * @version CVS $Id: BaseMap.java 46253 2004-09-17 14:36:29Z vgritsenko $
26  */

27 abstract class BaseMap extends java.util.AbstractMap JavaDoc {
28
29     static class Entry implements Map.Entry JavaDoc {
30         private final Object JavaDoc key;
31         private final Object JavaDoc value;
32
33         Entry(Object JavaDoc key, Object JavaDoc value) {
34             this.key = key;
35             this.value = value;
36         }
37
38         public Object JavaDoc getKey() {
39             return key;
40         }
41
42         public Object JavaDoc getValue() {
43             return value;
44         }
45
46         public Object JavaDoc setValue(Object JavaDoc value) {
47             throw new UnsupportedOperationException JavaDoc();
48         }
49
50         public int hashCode() {
51             return (key != null ? key.hashCode() : 0) ^ (value != null ? value.hashCode() : 0);
52         }
53
54         public boolean equals(Object JavaDoc obj) {
55             if (obj == null || !(obj instanceof Map.Entry JavaDoc)) {
56                 return false;
57             }
58
59             Map.Entry JavaDoc other = (Map.Entry JavaDoc) obj;
60             Object JavaDoc key = other.getKey();
61             if (key == this.key || key != null && key.equals(this.key)) {
62                 Object JavaDoc value = other.getValue();
63                 return value == this.value || value != null && value.equals(this.value);
64             }
65             return false;
66         }
67     }
68
69
70     BaseMap() {
71     }
72
73     public void clear() {
74         throw new UnsupportedOperationException JavaDoc();
75     }
76
77     public void putAll(Map JavaDoc t) {
78         throw new UnsupportedOperationException JavaDoc();
79     }
80
81     public Object JavaDoc remove(Object JavaDoc key) {
82         throw new UnsupportedOperationException JavaDoc();
83     }
84
85     public Set JavaDoc entrySet() {
86         throw new UnsupportedOperationException JavaDoc();
87     }
88 }
89
Popular Tags