/** * Returns the bean version of the property name if the method * is a getter, or returns null if the method is not a getter * * @param method The method to get the property name from * @return The java-bean version of the property name or null * if the method is not a java-bean getter */ public static String getBeanPropertyNameFromGetter(final Method method) { return isAGetter(method); }
/** * Returns the bean version of the property name if the method * is a getter, or returns null if the method is not a getter * * @param method The method to get the property name from * @return The java-bean version of the property name or null * if the method is not a java-bean getter */ public static String getBeanPropertyNameFromGetter(final Method method) { return isAGetter(new MethodWrapper() { @Override public Method getMethod() { return method; } }); }
/** * Returns the bean version of the property name if the method * is a getter, or returns null if the method is not a getter * * @param method The method to get the property name from * @return The java-bean version of the property name or null * if the method is not a java-bean getter */ public static String getBeanPropertyNameFromGetter(final Method method) { return isAGetter(new MethodWrapper() { @Override public Method getMethod() { return method; } }); }
/** * Returns the bean version of the property name if the method * is a getter, or returns null if the method is not a getter * * @param method The method to get the property name from * @return The java-bean version of the property name or null * if the method is not a java-bean getter */ public static String getBeanPropertyNameFromGetter(final Method method) { return isAGetter(new MethodWrapper() { @Override public Method getMethod() { return method; } }); }
/** * Returns the property name if this is a getter * * @param method The method to investigate for being a property * @return The property name or null if not a getter */ private static String isAGetter(MethodWrapper method) { return isAGetter(method.getMethod()); }
/** * Converts a Java bean to a bean-like Map * * @param helper A ClassReflectionHelper to use for analyzing classes * @param bean a non-null bean to convert * @return a possibly zero length but never null bean-like map. All properties of the bean are filled * in, even if the value of the property is null */ public static Map<String, Object> convertJavaBeanToBeanLikeMap(ClassReflectionHelper helper, Object bean) { HashMap<String, Object> retVal = new HashMap<String, Object>(); Set<MethodWrapper> methods = helper.getAllMethods(bean.getClass()); for (MethodWrapper wrapper : methods) { String propName = isAGetter(wrapper); if (propName == null) continue; if ("class".equals(propName)) continue; Method method = wrapper.getMethod(); Object value = getValue(bean, method); retVal.put(propName, value); } return retVal; } }
/** * Converts a Java bean to a bean-like Map * * @param helper A ClassReflectionHelper to use for analyzing classes * @param bean a non-null bean to convert * @return a possibly zero length but never null bean-like map. All properties of the bean are filled * in, even if the value of the property is null */ public static Map<String, Object> convertJavaBeanToBeanLikeMap(ClassReflectionHelper helper, Object bean) { HashMap<String, Object> retVal = new HashMap<String, Object>(); Set<MethodWrapper> methods = helper.getAllMethods(bean.getClass()); for (MethodWrapper wrapper : methods) { String propName = isAGetter(wrapper); if (propName == null) continue; if ("class".equals(propName)) continue; Method method = wrapper.getMethod(); Object value = getValue(bean, method); retVal.put(propName, value); } return retVal; } }
/** * Converts a Java bean to a bean-like Map * * @param helper A ClassReflectionHelper to use for analyzing classes * @param bean a non-null bean to convert * @return a possibly zero length but never null bean-like map. All properties of the bean are filled * in, even if the value of the property is null */ public static Map<String, Object> convertJavaBeanToBeanLikeMap(ClassReflectionHelper helper, Object bean) { HashMap<String, Object> retVal = new HashMap<String, Object>(); Set<MethodWrapper> methods = helper.getAllMethods(bean.getClass()); for (MethodWrapper wrapper : methods) { String propName = isAGetter(wrapper); if (propName == null) continue; if ("class".equals(propName)) continue; Method method = wrapper.getMethod(); Object value = getValue(bean, method); retVal.put(propName, value); } return retVal; } }
/** * Converts a Java bean to a bean-like Map * * @param helper A ClassReflectionHelper to use for analyzing classes * @param bean a non-null bean to convert * @return a possibly zero length but never null bean-like map. All properties of the bean are filled * in, even if the value of the property is null */ public static Map<String, Object> convertJavaBeanToBeanLikeMap(ClassReflectionHelper helper, Object bean) { HashMap<String, Object> retVal = new HashMap<String, Object>(); Set<MethodWrapper> methods = helper.getAllMethods(bean.getClass()); for (MethodWrapper wrapper : methods) { String propName = isAGetter(wrapper); if (propName == null) continue; if ("class".equals(propName)) continue; Method method = wrapper.getMethod(); Object value = getValue(bean, method); retVal.put(propName, value); } return retVal; } }
String propName = isAGetter(wrapper); if (propName == null) continue;
String propName = isAGetter(wrapper); if (propName == null) continue;
String propName = isAGetter(wrapper); if (propName == null) continue;
String propName = isAGetter(wrapper); if (propName == null) continue;