/**
* @param bean The instance that has properties named according to JavaBean standard.
* @return Map<String, Object> that should be considered immutable
*/
protected Map getBeanProperties(Object bean) {
HashMap values = new HashMap();
if (bean == null) return values;
Method[] m = bean.getClass().getMethods();
Pattern p = Pattern.compile("get([A-Z]\\w+)");
for (int i = 0; i < m.length; i++) {
if (m[i].getName().equals("getClass")) continue;
if (m[i].getParameterTypes().length > 0) continue;
Matcher r = p.matcher(m[i].getName());
if (r.matches()) {
try {
values.put(r.group(1).toLowerCase(), m[i].invoke(bean, new Object[0]));
} catch (IllegalArgumentException e) {
throw e;
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {