1 55 56 package org.jboss.axis.transport.jms; 57 58 import java.util.Map ; 59 60 67 public class MapUtils 68 { 69 77 public static int removeIntProperty(Map properties, String key, int defaultValue) 78 { 79 int value = defaultValue; 80 if (properties != null && properties.containsKey(key)) 81 { 82 try 83 { 84 value = ((Integer )properties.remove(key)).intValue(); 85 } 86 catch (Exception ignore) 87 { 88 } 89 } 90 return value; 91 } 92 93 101 public static long removeLongProperty(Map properties, String key, long defaultValue) 102 { 103 long value = defaultValue; 104 if (properties != null && properties.containsKey(key)) 105 { 106 try 107 { 108 value = ((Long )properties.remove(key)).longValue(); 109 } 110 catch (Exception ignore) 111 { 112 } 113 } 114 return value; 115 } 116 117 125 public static String removeStringProperty(Map properties, String key, String defaultValue) 126 { 127 String value = defaultValue; 128 if (properties != null && properties.containsKey(key)) 129 { 130 try 131 { 132 value = (String )properties.remove(key); 133 } 134 catch (Exception ignore) 135 { 136 } 137 } 138 return value; 139 } 140 141 149 public static boolean removeBooleanProperty(Map properties, String key, boolean defaultValue) 150 { 151 boolean value = defaultValue; 152 if (properties != null && properties.containsKey(key)) 153 { 154 try 155 { 156 value = ((Boolean )properties.remove(key)).booleanValue(); 157 } 158 catch (Exception ignore) 159 { 160 } 161 } 162 return value; 163 } 164 165 173 public static Object removeObjectProperty(Map properties, String key, Object defaultValue) 174 { 175 Object value = defaultValue; 176 if (properties != null && properties.containsKey(key)) 177 { 178 value = properties.remove(key); 179 } 180 return value; 181 } 182 } 183 | Popular Tags |