/** * Find a method with the right name If found, call the method ( if param is * int or boolean we'll convert value to the right type before) - that means * you can have setDebug(1). */ final public static boolean setProperty(Object o, String name, String value) { String setter = "set" + capitalize(name); return invokeProperty(o, setter, name, value); }
final public static boolean addProperty(Object o, String name, String value) { String setter = "add" + capitalize(name); return invokeProperty(o, setter, name, value); }
public static Object getProperty(Object object, String name) { String getter = "get" + capitalize(name); String isGetter = "is" + capitalize(name);
/** */ public static void setProperty(Object object, String name) { String setter = "set" + capitalize(name); try { Method methods[] = findMethods(object.getClass()); Method setPropertyMethod = null; // find setFoo() method for (int i = 0; i < methods.length; i++) { Class<?> paramT[] = methods[i].getParameterTypes(); if (setter.equals(methods[i].getName()) && paramT.length == 0) { methods[i].invoke(object, new Object[]{}); return; } } } catch (Exception e) { if (dbg > 0) { debug("Exception for " + object.getClass() + " " + name); } if (dbg > 1) { logger.debug("", e); } } }
/** * Find a method with the right name If found, call the method ( if param is * int or boolean we'll convert value to the right type before) - that means * you can have setDebug(1). */ final public static boolean setProperty(Object o, String name, String value) { String setter = "set" + capitalize(name); return invokeProperty(o,setter,name,value); }
final public static boolean addProperty(Object o, String name, String value) { String setter = "add" + capitalize(name); return invokeProperty(o,setter,name,value); }
/** */ public static void setProperty(Object o, String name) { String setter = "set" + capitalize(name); try { Method methods[] = findMethods(o.getClass()); Method setPropertyMethod = null; // find setFoo() method for (int i = 0; i < methods.length; i++) { Class<?> paramT[] = methods[i].getParameterTypes(); if (setter.equals(methods[i].getName()) && paramT.length == 0) { methods[i].invoke(o, new Object[] {}); return; } } } catch (Exception ex1) { if (dbg > 0) d("Exception for " + o.getClass() + " " + name); if (dbg > 1) ex1.printStackTrace(); } }
public static Object getProperty(Object o, String name) { String getter = "get" + capitalize(name); String isGetter = "is" + capitalize(name);