예제 #1
0
 private static Object getValue(Object bean, String fieldName) throws Exception {
   final String getter = RichBeanUtils.getGetterName(fieldName);
   try {
     return bean.getClass().getMethod(getter).invoke(bean);
   } catch (java.lang.NoSuchMethodException ne) {
     final String isser = RichBeanUtils.getIsserName(fieldName);
     return bean.getClass().getMethod(isser).invoke(bean);
   }
 }
예제 #2
0
 /**
  * Get the ui field out of the object container.
  *
  * @param fieldName
  * @param uiObject
  * @return IFieldWidget or null if is not an IFieldWidget instance
  * @throws Exception
  * @throws NoSuchMethodException
  * @throws SecurityException
  * @throws InvocationTargetException
  * @throws IllegalAccessException
  * @throws IllegalArgumentException
  */
 public static IFieldWidget getFieldWidget(final String fieldName, final Object uiObject)
     throws Exception {
   final String methodName = RichBeanUtils.getGetterName(fieldName);
   final Method getter = uiObject.getClass().getMethod(methodName);
   final Object box = getter.invoke(uiObject);
   if (box instanceof IFieldWidget) {
     return (IFieldWidget) box;
   }
   return null;
 }