org.apache.commons.collections.ProxyMap Maven / Gradle / Ivy
Show all versions of aem-sdk-api Show documentation
/*
* 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.commons.collections;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
/**
* This Map
wraps another Map
* implementation, using the wrapped instance for its default
* implementation. This class is used as a framework on which to
* build to extensions for its wrapped Map
object which
* would be unavailable or inconvenient via sub-classing (but usable
* via composition).
*
* This implementation does not perform any special processing with
* {@link #entrySet()}, {@link #keySet()} or {@link #values()}. Instead
* it simply returns the set/collection from the wrapped map. This may be
* undesirable, for example if you are trying to write a validating
* implementation it would provide a loophole around the validation. But,
* you might want that loophole, so this class is kept simple.
*
* @deprecated Moved to map subpackage as AbstractMapDecorator. It will be removed in v4.0.
* @since Commons Collections 2.0
* @version $Revision$ $Date$
*
* @author Daniel Rall
* @author Stephen Colebourne
*
* @deprecated Apache Commons Collections version 3.x is being deprecated from AEMaaCS. The upgraded version 4.4 of Commons Collections is already included as replacement. Customers are advised to upgrade to this version of the library. Please note: the package name was changed to org.apache.commons.collections4. Further note that there are AEM APIs currently exposing the old collections classes; these will be updated in upcoming releases.
*/
@Deprecated(since = "2021-04-30")
public abstract class ProxyMap implements Map {
/**
* The Map
to delegate to.
*/
protected Map map;
/**
* Constructor that uses the specified map to delegate to.
*
* Note that the map is used for delegation, and is not copied. This is
* different to the normal use of a Map
parameter in
* collections constructors.
*
* @param map the Map
to delegate to
*/
public ProxyMap(Map map) {
this.map = map;
}
/**
* Invokes the underlying {@link Map#clear()} method.
*/
public void clear() {
map.clear();
}
/**
* Invokes the underlying {@link Map#containsKey(Object)} method.
*/
public boolean containsKey(Object key) {
return map.containsKey(key);
}
/**
* Invokes the underlying {@link Map#containsValue(Object)} method.
*/
public boolean containsValue(Object value) {
return map.containsValue(value);
}
/**
* Invokes the underlying {@link Map#entrySet()} method.
*/
public Set entrySet() {
return map.entrySet();
}
/**
* Invokes the underlying {@link Map#equals(Object)} method.
*/
public boolean equals(Object m) {
return map.equals(m);
}
/**
* Invokes the underlying {@link Map#get(Object)} method.
*/
public Object get(Object key) {
return map.get(key);
}
/**
* Invokes the underlying {@link Map#hashCode()} method.
*/
public int hashCode() {
return map.hashCode();
}
/**
* Invokes the underlying {@link Map#isEmpty()} method.
*/
public boolean isEmpty() {
return map.isEmpty();
}
/**
* Invokes the underlying {@link Map#keySet()} method.
*/
public Set keySet() {
return map.keySet();
}
/**
* Invokes the underlying {@link Map#put(Object,Object)} method.
*/
public Object put(Object key, Object value) {
return map.put(key, value);
}
/**
* Invokes the underlying {@link Map#putAll(Map)} method.
*/
public void putAll(Map t) {
map.putAll(t);
}
/**
* Invokes the underlying {@link Map#remove(Object)} method.
*/
public Object remove(Object key) {
return map.remove(key);
}
/**
* Invokes the underlying {@link Map#size()} method.
*/
public int size() {
return map.size();
}
/**
* Invokes the underlying {@link Map#values()} method.
*/
public Collection values() {
return map.values();
}
}