args.add(value);
if(value instanceof Enum) { Enum enumerate = (Enum) value; args.add(RenderUtils.getEnumString(enumerate, null)); } else { args.add(value); }
    public static String getFormattedProperties(String format, Object object) {        // "${a.b} - ${a.c} - ${b,-4.5tY}"         // String.format("%s - %s - %-4.5tY", object.getA().getB(), object.getA().getC(), object.getB())                // TODO: use a separator different than ',' because the comma can be used as a flag in the format                 List args = new ArrayList();        StringBuilder builder = new StringBuilder();                if (format != null) {            int lastIndex = 0, index;                        while ((index = format.indexOf("${", lastIndex)) != -1) {                int end = format.indexOf("}", index + 2);                                if (end == -1) {                    throw new RuntimeException("'" + format + "':unmatched group at pos " + index);                }                                builder.append(format.substring(lastIndex, index));                lastIndex = end + 1;                if (end - index == 2) {                    continue;                }                                String spec = format.substring(index + 2, end);                String[] parts = spec.split(",");                                String property = parts[0];                                if (parts.length > 1) {                    builder.append("%" + parts[1]);                }                else {                    builder.append("%s");                }                                try {                    Object value = PropertyUtils.getProperty(object, property);                                        args.add(value);                } catch (Exception e) {                    throw new RuntimeException("could not retrieve property '" + property + "' for object " + object, e);                }            }                        builder.append(format.substring(lastIndex));        }                return String.format(getLocale(), builder.toString(), args.toArray());    }