1 package net.sf.cantina.util;
2
3 /***
4 * @author Stephane JAIS
5 */
6 public abstract class BeanUtils
7 {
8 public static Object getProperty(Object o, String propName)
9 throws Exception
10 {
11 return o.getClass().getMethod(
12 "get"+propName.substring(0,1).toUpperCase()+propName.substring(1),
13 new Class[] {}).invoke(o, new Object[] {});
14 }
15
16 public static Class getPropertyClass(Class c, String propName)
17 throws Exception
18 {
19 return c.getMethod(
20 "get"+propName.substring(0,1).toUpperCase()+propName.substring(1),
21 new Class[] {}).getReturnType();
22 }
23 }