/*
* #%L
* Gravia :: Resource
* %%
* Copyright (C) 2010 - 2014 JBoss by Red Hat
* %%
* Licensed 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.
* #L%
*/
package org.jboss.gravia.utils;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
/**
* A Map that does not allow put operations.
*
* @author thomas.diesler@jboss.com
* @since 23-Jan-2013
*/
public final class RemoveOnlyMap<K,V> implements Map<K,V> {
Map<K,V> delegate;
public RemoveOnlyMap(Map<K,V> delegate) {
if (delegate == null)
throw new IllegalArgumentException("delegate");
this.delegate = delegate;
}
@Override
public void clear() {
delegate.clear();
}
@Override
public boolean containsKey(Object arg0) {
return delegate.containsKey(arg0);
}
@Override
public boolean containsValue(Object arg0) {
return delegate.containsValue(arg0);
}
@Override
public Set<Map.Entry<K, V>> entrySet() {
return delegate.entrySet();
}
@Override
public V get(Object arg0) {
return delegate.get(arg0);
}
@Override
public boolean isEmpty() {
return delegate.isEmpty();
}
@Override
public Set<K> keySet() {
return delegate.keySet();
}
@Override
public V put(K arg0, V arg1) {
throw new UnsupportedOperationException();
}
@Override
public void putAll(Map<? extends K, ? extends V> arg0) {
throw new UnsupportedOperationException();
}
@Override
public V remove(Object arg0) {
return delegate.remove(arg0);
}
@Override
public int size() {
return delegate.size();
}
@Override
public Collection<V> values() {
return delegate.values();
}
@Override
public int hashCode() {
return delegate.hashCode();
}
@Override
public boolean equals(Object obj) {
return delegate.equals(obj);
}
@Override
public String toString() {
return delegate.toString();
}
}