class BeanUtils {

    public static Map<String, Object> beanToMap(Object bean) throws InvocationTargetException {
        if (bean == null) {
            return null;
        }
        Map<String, Object> result = new HashMap<String, Object>();
        Collection<Method> getters = getGetters(bean);
        for (Method method : getGetters(bean)) {
            try {
                result.put(toAttributeName(method), method.invoke(bean));
            } catch (IllegalAccessException ex) {
                //Checked - can not happen
            } catch (IllegalArgumentException ex) {
                //Checked - can not happen
            }
        }
        return result;
    }

}