001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.internal; 014 015import java.util.*; 016 017/** 018 * Wraps an existing map inside an extensible interface so that convenience methods can be added to the subclass. 019 * 020 * @param <K> The key type. 021 * @param <V> The value type. 022 */ 023public class WrappedMap<K,V> implements Map<K,V> { 024 025 private final Map<K,V> inner; 026 027 /** 028 * Constructor. 029 * 030 * @param inner The inner map. 031 */ 032 protected WrappedMap(Map<K,V> inner) { 033 this.inner = inner; 034 } 035 036 @Override /* Map */ 037 public void clear() { 038 inner.clear(); 039 } 040 041 @Override 042 public boolean containsKey(Object key) { 043 return inner.containsKey(key); 044 } 045 046 @Override /* Map */ 047 public boolean containsValue(Object value) { 048 return inner.containsValue(value); 049 } 050 051 @Override /* Map */ 052 public Set<java.util.Map.Entry<K,V>> entrySet() { 053 return inner.entrySet(); 054 } 055 056 @Override /* Map */ 057 public V get(Object key) { 058 return inner.get(key); 059 } 060 061 @Override /* Map */ 062 public boolean isEmpty() { 063 return inner.isEmpty(); 064 } 065 066 @Override /* Map */ 067 public Set<K> keySet() { 068 return inner.keySet(); 069 } 070 071 @Override /* Map */ 072 public V put(K key, V value) { 073 return inner.put(key, value); 074 } 075 076 @Override /* Map */ 077 public void putAll(Map<? extends K,? extends V> m) { 078 inner.putAll(m); 079 } 080 081 @Override /* Map */ 082 public V remove(Object key) { 083 return inner.remove(key); 084 } 085 086 @Override /* Map */ 087 public int size() { 088 return inner.size(); 089 } 090 091 @Override /* Map */ 092 public Collection<V> values() { 093 return inner.values(); 094 } 095}