1 16 17 18 package org.apache.commons.beanutils; 19 20 import java.lang.reflect.InvocationTargetException ; 21 import java.util.Map ; 22 23 import org.apache.commons.collections.FastHashMap; 24 25 26 41 42 public class BeanUtils { 43 44 45 47 48 55 private static FastHashMap dummy = new FastHashMap(); 56 57 63 private static int debug = 0; 64 65 70 public static int getDebug() { 71 return (debug); 72 } 73 74 79 public static void setDebug(int newDebug) { 80 debug = newDebug; 81 } 82 83 85 86 94 public static Object cloneBean(Object bean) 95 throws IllegalAccessException , InstantiationException , 96 InvocationTargetException , NoSuchMethodException { 97 98 return BeanUtilsBean.getInstance().cloneBean(bean); 99 100 } 101 102 103 111 public static void copyProperties(Object dest, Object orig) 112 throws IllegalAccessException , InvocationTargetException { 113 114 BeanUtilsBean.getInstance().copyProperties(dest, orig); 115 } 116 117 118 126 public static void copyProperty(Object bean, String name, Object value) 127 throws IllegalAccessException , InvocationTargetException { 128 129 BeanUtilsBean.getInstance().copyProperty(bean, name, value); 130 } 131 132 133 141 public static Map describe(Object bean) 142 throws IllegalAccessException , InvocationTargetException , 143 NoSuchMethodException { 144 145 return BeanUtilsBean.getInstance().describe(bean); 146 } 147 148 149 157 public static String [] getArrayProperty(Object bean, String name) 158 throws IllegalAccessException , InvocationTargetException , 159 NoSuchMethodException { 160 161 return BeanUtilsBean.getInstance().getArrayProperty(bean, name); 162 } 163 164 165 173 public static String getIndexedProperty(Object bean, String name) 174 throws IllegalAccessException , InvocationTargetException , 175 NoSuchMethodException { 176 177 return BeanUtilsBean.getInstance().getIndexedProperty(bean, name); 178 179 } 180 181 182 191 public static String getIndexedProperty(Object bean, 192 String name, int index) 193 throws IllegalAccessException , InvocationTargetException , 194 NoSuchMethodException { 195 196 return BeanUtilsBean.getInstance().getIndexedProperty(bean, name, index); 197 198 } 199 200 201 209 public static String getMappedProperty(Object bean, String name) 210 throws IllegalAccessException , InvocationTargetException , 211 NoSuchMethodException { 212 213 return BeanUtilsBean.getInstance().getMappedProperty(bean, name); 214 215 } 216 217 218 226 public static String getMappedProperty(Object bean, 227 String name, String key) 228 throws IllegalAccessException , InvocationTargetException , 229 NoSuchMethodException { 230 231 return BeanUtilsBean.getInstance().getMappedProperty(bean, name, key); 232 233 } 234 235 236 244 public static String getNestedProperty(Object bean, String name) 245 throws IllegalAccessException , InvocationTargetException , 246 NoSuchMethodException { 247 248 return BeanUtilsBean.getInstance().getNestedProperty(bean, name); 249 250 } 251 252 253 261 public static String getProperty(Object bean, String name) 262 throws IllegalAccessException , InvocationTargetException , 263 NoSuchMethodException { 264 265 return BeanUtilsBean.getInstance().getProperty(bean, name); 266 267 } 268 269 270 278 public static String getSimpleProperty(Object bean, String name) 279 throws IllegalAccessException , InvocationTargetException , 280 NoSuchMethodException { 281 282 return BeanUtilsBean.getInstance().getSimpleProperty(bean, name); 283 284 } 285 286 287 295 public static void populate(Object bean, Map properties) 296 throws IllegalAccessException , InvocationTargetException { 297 298 BeanUtilsBean.getInstance().populate(bean, properties); 299 } 300 301 302 310 public static void setProperty(Object bean, String name, Object value) 311 throws IllegalAccessException , InvocationTargetException { 312 313 BeanUtilsBean.getInstance().setProperty(bean, name, value); 314 } 315 } 316 | Popular Tags |