public String formatDecimal(final Number target, final Integer minIntegerDigits, final String thousandsPointType, final Integer decimalDigits, final String decimalPointType) {
final NumberPointType decimalNumberPointType = NumberPointType.match(decimalPointType);
if (decimalNumberPointType == null) {
throw new TemplateProcessingException(
"Unrecognized point format \"" + decimalPointType + "\"");
}
final NumberPointType thousandsNumberPointType = NumberPointType.match(thousandsPointType);
if (thousandsNumberPointType == null) {
throw new TemplateProcessingException(
"Unrecognized point format \"" + thousandsPointType + "\"");
}
try {
return NumberUtils.format(target, minIntegerDigits, thousandsNumberPointType, decimalDigits, decimalNumberPointType, this.locale);
} catch (final Exception e) {
throw new TemplateProcessingException(
"Error formatting decimal with minimum integer digits = " + minIntegerDigits +
", thousands point type = " + thousandsPointType + ", decimal digits = " + decimalDigits +
" and decimal point type = " + decimalPointType, e);
}
}