Coverage Report - org.apache.commons.convert1.util.ProxyMap
 
Classes in this File Line Coverage Branch Coverage Complexity
ProxyMap
0%
0/19
N/A
1
 
 1  
 /*
 2  
  *  Copyright 2003-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.commons.convert1.util;
 17  
 
 18  
 import java.util.Collection;
 19  
 import java.util.Map;
 20  
 import java.util.Set;
 21  
 
 22  
 /** 
 23  
  * <p>This <code>Map</code> wraps another <code>Map</code>
 24  
  * implementation, using the wrapped instance for its default
 25  
  * implementation.  This class is used as a framework on which to
 26  
  * build to extensions for its wrapped <code>Map</code> object which
 27  
  * would be unavailable or inconvenient via sub-classing (but usable
 28  
  * via composition).</p>
 29  
  * 
 30  
  * <p>This implementation does not perform any special processing with
 31  
  * {@link #entrySet()}, {@link #keySet()} or {@link #values()}. Instead
 32  
  * it simply returns the set/collection from the wrapped map. This may be
 33  
  * undesirable, for example if you are trying to write a validating
 34  
  * implementation it would provide a loophole around the validation. But,
 35  
  * you might want that loophole, so this class is kept simple.</p>
 36  
  *
 37  
  * @deprecated This class has been moved to the decorators sub-package
 38  
  * and renamed to AbstractMapDecorator. It will be removed in v4.0.
 39  
  * @since Commons Collections 2.0
 40  
  * @version $Id: ProxyMap.java 155441 2005-02-26 13:19:22Z dirkv $
 41  
  * 
 42  
  * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
 43  
  * @author Stephen Colebourne
 44  
  */
 45  
 abstract class ProxyMap implements Map {
 46  
     
 47  
     /**
 48  
      * The <code>Map</code> to delegate to.
 49  
      */
 50  
     protected Map map;
 51  
 
 52  
     /**
 53  
      * Constructor that uses the specified map to delegate to.
 54  
      * <p>
 55  
      * Note that the map is used for delegation, and is not copied. This is
 56  
      * different to the normal use of a <code>Map</code> parameter in
 57  
      * collections constructors.
 58  
      *
 59  
      * @param map  the <code>Map</code> to delegate to
 60  
      */
 61  0
     public ProxyMap(Map map) {
 62  0
         this.map = map;
 63  0
     }
 64  
 
 65  
     /**
 66  
      * Invokes the underlying {@link Map#clear()} method.
 67  
      */
 68  
     public void clear() {
 69  0
         map.clear();
 70  0
     }
 71  
 
 72  
     /**
 73  
      * Invokes the underlying {@link Map#containsKey(Object)} method.
 74  
      */
 75  
     public boolean containsKey(Object key) {
 76  0
         return map.containsKey(key);
 77  
     }
 78  
 
 79  
     /**
 80  
      * Invokes the underlying {@link Map#containsValue(Object)} method.
 81  
      */
 82  
     public boolean containsValue(Object value) {
 83  0
         return map.containsValue(value);
 84  
     }
 85  
 
 86  
     /**
 87  
      * Invokes the underlying {@link Map#entrySet()} method.
 88  
      */
 89  
     public Set entrySet() {
 90  0
         return map.entrySet();
 91  
     }
 92  
 
 93  
     /**
 94  
      * Invokes the underlying {@link Map#equals(Object)} method.
 95  
      */
 96  
     public boolean equals(Object m) {
 97  0
         return map.equals(m);
 98  
     }
 99  
 
 100  
     /**
 101  
      * Invokes the underlying {@link Map#get(Object)} method.
 102  
      */
 103  
     public Object get(Object key) {
 104  0
         return map.get(key);
 105  
     }
 106  
 
 107  
     /**
 108  
      * Invokes the underlying {@link Map#hashCode()} method.
 109  
      */
 110  
     public int hashCode() {
 111  0
         return map.hashCode();
 112  
     }
 113  
 
 114  
     /**
 115  
      * Invokes the underlying {@link Map#isEmpty()} method.
 116  
      */
 117  
     public boolean isEmpty() {
 118  0
         return map.isEmpty();
 119  
     }
 120  
 
 121  
     /**
 122  
      * Invokes the underlying {@link Map#keySet()} method.
 123  
      */
 124  
     public Set keySet() {
 125  0
         return map.keySet();
 126  
     }
 127  
 
 128  
     /**
 129  
      * Invokes the underlying {@link Map#put(Object,Object)} method.
 130  
      */
 131  
     public Object put(Object key, Object value) {
 132  0
         return map.put(key, value);
 133  
     }
 134  
 
 135  
     /**
 136  
      * Invokes the underlying {@link Map#putAll(Map)} method.
 137  
      */
 138  
     public void putAll(Map t) {
 139  0
         map.putAll(t);
 140  0
     }
 141  
 
 142  
     /**
 143  
      * Invokes the underlying {@link Map#remove(Object)} method.
 144  
      */
 145  
     public Object remove(Object key) {
 146  0
         return map.remove(key);
 147  
     }
 148  
 
 149  
     /**
 150  
      * Invokes the underlying {@link Map#size()} method.
 151  
      */
 152  
     public int size() {
 153  0
         return map.size();
 154  
     }
 155  
 
 156  
     /**
 157  
      * Invokes the underlying {@link Map#values()} method.
 158  
      */
 159  
     public Collection values() {
 160  0
         return map.values();
 161  
     }
 162  
    
 163  
 }