blob: 66b945c37878ff5ee0bbc71efb67416eab628b3f [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.cocoon.faces.context;
import java.util.Map;
import java.util.Set;
/**
* Base class for JSF context maps
*
* @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
* @version CVS $Id$
*/
abstract class BaseMap extends java.util.AbstractMap {
static class Entry implements Map.Entry {
private final Object key;
private final Object value;
Entry(Object key, Object value) {
this.key = key;
this.value = value;
}
public Object getKey() {
return key;
}
public Object getValue() {
return value;
}
public Object setValue(Object value) {
throw new UnsupportedOperationException();
}
public int hashCode() {
return (key != null ? key.hashCode() : 0) ^ (value != null ? value.hashCode() : 0);
}
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof Map.Entry)) {
return false;
}
Map.Entry other = (Map.Entry) obj;
Object key = other.getKey();
if (key == this.key || key != null && key.equals(this.key)) {
Object value = other.getValue();
return value == this.value || value != null && value.equals(this.value);
}
return false;
}
}
BaseMap() {
}
public void clear() {
throw new UnsupportedOperationException();
}
public void putAll(Map t) {
throw new UnsupportedOperationException();
}
public Object remove(Object key) {
throw new UnsupportedOperationException();
}
public Set entrySet() {
throw new UnsupportedOperationException();
}
}