1 16 17 package org.apache.axis.transport.jms; 18 19 import java.util.Map ; 20 21 28 public class MapUtils 29 { 30 38 public static int removeIntProperty(Map properties, String key, int defaultValue) 39 { 40 int value = defaultValue; 41 if(properties != null && properties.containsKey(key)) 42 { 43 try{value = ((Integer )properties.remove(key)).intValue();}catch(Exception ignore){} 44 } 45 return value; 46 } 47 48 56 public static long removeLongProperty(Map properties, String key, long defaultValue) 57 { 58 long value = defaultValue; 59 if(properties != null && properties.containsKey(key)) 60 { 61 try{value = ((Long )properties.remove(key)).longValue();}catch(Exception ignore){} 62 } 63 return value; 64 } 65 66 74 public static String removeStringProperty(Map properties, String key, String defaultValue) 75 { 76 String value = defaultValue; 77 if(properties != null && properties.containsKey(key)) 78 { 79 try{value = (String )properties.remove(key);}catch(Exception ignore){} 80 } 81 return value; 82 } 83 84 92 public static boolean removeBooleanProperty(Map properties, String key, boolean defaultValue) 93 { 94 boolean value = defaultValue; 95 if(properties != null && properties.containsKey(key)) 96 { 97 try{value = ((Boolean )properties.remove(key)).booleanValue();}catch(Exception ignore){} 98 } 99 return value; 100 } 101 102 110 public static Object removeObjectProperty(Map properties, String key, Object defaultValue) 111 { 112 Object value = defaultValue; 113 if(properties != null && properties.containsKey(key)) 114 { 115 value = properties.remove(key); 116 } 117 return value; 118 } 119 } 120 | Popular Tags |