/** * Converts the value into a string, with the appropriate formatting * * @param fieldActualValue actual field value * @param fieldType field type (i.e. "String", "Integer", "Date") * @return String object value as a string */ public static String convertToString(Object fieldActualValue, String fieldType) { if (fieldActualValue == null) { return ""; } if ("String".equals(fieldType)) { return (String) fieldActualValue; } else if ("Integer".equals(fieldType)) { Integer i = (Integer) fieldActualValue; return i.toString(); } else if ("KualiDecimal".equals(fieldType)) { KualiDecimal kd = (KualiDecimal) fieldActualValue; return kd.toString(); } else if ("BigDecimal".equals(fieldType)) { BigDecimal bd = (BigDecimal) fieldActualValue; return bd.toString(); } else if ("Date".equals(fieldType)) { Date d = (Date) fieldActualValue; SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); return df.format(d); } return ""; }