List of usage examples for java.text DecimalFormat getMaximumFractionDigits
@Override public int getMaximumFractionDigits()
From source file:br.com.nordestefomento.jrimum.utilix.Field.java
@SuppressWarnings("unchecked") private void readDecimalField(String valueAsString) { DecimalFormat decimalFormat = (DecimalFormat) format; try {//from w ww . ja v a2s . c om Long parsedValue = (Long) format.parseObject(valueAsString); BigDecimal decimalValue = new BigDecimal(parsedValue.longValue()); decimalValue = decimalValue.movePointLeft(decimalFormat.getMaximumFractionDigits()); value = (G) decimalValue; } catch (ParseException e) { getGenericReadError(e, valueAsString); } }
From source file:org.jrimum.utilix.text.Field.java
/** * L campos de valores decimais. O parse feito atravs de formatadores de nmeros decimais. * @param valueAsString/* www .ja v a 2 s . co m*/ */ @SuppressWarnings("unchecked") private void readDecimalField(String valueAsString) { DecimalFormat decimalFormat = (DecimalFormat) format; try { Long parsedValue = (Long) format.parseObject(valueAsString); BigDecimal decimalValue = new BigDecimal(parsedValue.longValue()); decimalValue = decimalValue.movePointLeft(decimalFormat.getMaximumFractionDigits()); value = (G) decimalValue; } catch (ParseException e) { getGenericReadError(e, valueAsString); } }