/** * Retrieve enumerated value * * @param value * @return */ public static NumericType getEnum(String value) { for (NumericType enumerated : values()) { if (enumerated.value.equalsIgnoreCase(value)) { return enumerated; } } throw new IllegalArgumentException(); }
/** * Gets the numeric format defined in numeric.properties * * @return numeric format */ private static NumberFormat getNumberFormat(String type) { NumberFormat numberFormat; // Apply locale based on numeric.properties switch (NumericType.getEnum(type)) { case AME: case AME_NO: // American formatting numberFormat = AMERICAN_NUMBER_FORMAT; break; default: // European formatting numberFormat = EUROPEAN_NUMBER_FORMAT; break; } // Apply rounding based on numeric.properties numberFormat.setRoundingMode(roundingType.getRoundingMode()); return numberFormat; } }