public String getValue(String key) { final SufdAttribute attr = getSufdDescriptor().get(key); ELContext elContext = FacesContext.getCurrentInstance().getELContext(); ExpressionFactory f = FacesContext.getCurrentInstance().getApplication().getExpressionFactory(); ValueExpression ex = f.createValueExpression(elContext, attr.getValue(), Object.class); final Object value = ex.getValue(elContext); if (value instanceof LocalDate) { return ((LocalDate) value).format(dateTimeFormatter); } else if (value instanceof BigDecimal) { return decimalFormatter.format(value); } else { return value.toString(); } }
public SufdAttribute addNewSufdAttribute() { SufdAttribute attribute = new SufdAttribute("KEY", this); attribute.setTreasury(this); sufdDescriptor.put(attribute.getKey(), attribute); return attribute; }