1 17 18 19 package org.apache.catalina.util; 20 21 22 import java.util.HashMap ; 23 import java.util.Map ; 24 25 26 36 37 public final class ParameterMap extends HashMap { 38 39 40 42 43 47 public ParameterMap() { 48 49 super(); 50 51 } 52 53 54 60 public ParameterMap(int initialCapacity) { 61 62 super(initialCapacity); 63 64 } 65 66 67 74 public ParameterMap(int initialCapacity, float loadFactor) { 75 76 super(initialCapacity, loadFactor); 77 78 } 79 80 81 86 public ParameterMap(Map map) { 87 88 super(map); 89 90 } 91 92 93 95 96 99 private boolean locked = false; 100 101 102 105 public boolean isLocked() { 106 107 return (this.locked); 108 109 } 110 111 112 117 public void setLocked(boolean locked) { 118 119 this.locked = locked; 120 121 } 122 123 124 127 private static final StringManager sm = 128 StringManager.getManager("org.apache.catalina.util"); 129 130 131 133 134 135 140 public void clear() { 141 142 if (locked) 143 throw new IllegalStateException 144 (sm.getString("parameterMap.locked")); 145 super.clear(); 146 147 } 148 149 150 163 public Object put(Object key, Object value) { 164 165 if (locked) 166 throw new IllegalStateException 167 (sm.getString("parameterMap.locked")); 168 return (super.put(key, value)); 169 170 } 171 172 173 182 public void putAll(Map map) { 183 184 if (locked) 185 throw new IllegalStateException 186 (sm.getString("parameterMap.locked")); 187 super.putAll(map); 188 189 } 190 191 192 202 public Object remove(Object key) { 203 204 if (locked) 205 throw new IllegalStateException 206 (sm.getString("parameterMap.locked")); 207 return (super.remove(key)); 208 209 } 210 211 212 } 213 | Popular Tags |