@Test(expected = SuperCsvCellProcessorException.class) public void testWithNonNumber() { processor.execute("abc", ANONYMOUS_CSVCONTEXT); }
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof Number) ) { throw new SuperCsvCellProcessorException(Number.class, value, context, this); } final DecimalFormat decimalFormatter; try { decimalFormatter = formatter != null ? formatter : new DecimalFormat(decimalFormat); } catch(IllegalArgumentException e) { throw new SuperCsvCellProcessorException( String.format("'%s' is not a valid decimal format", decimalFormat), context, this, e); } final String result = decimalFormatter.format(value); return next.execute(result, context); }
FmtNumber extends CellProcessorAdaptor implements DoubleCellProcessor, LongCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof Number) ) { throw new SuperCsvCellProcessorException(Number.class, value, context, this); } final DecimalFormat decimalFormatter; try { decimalFormatter = formatter != null ? formatter : new DecimalFormat(decimalFormat); } catch(IllegalArgumentException e) { throw new SuperCsvCellProcessorException( String.format("'%s' is not a valid decimal format", decimalFormat), context, this, e); } final String result = decimalFormatter.format(value); return next.execute(result, context); } }
FmtNumber extends CellProcessorAdaptor implements DoubleCellProcessor, LongCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof Number) ) { throw new SuperCsvCellProcessorException(Number.class, value, context, this); } final DecimalFormat decimalFormatter; try { decimalFormatter = formatter != null ? formatter : new DecimalFormat(decimalFormat); } catch(IllegalArgumentException e) { throw new SuperCsvCellProcessorException( String.format("'%s' is not a valid decimal format", decimalFormat), context, this, e); } final String result = decimalFormatter.format(value); return next.execute(result, context); } FmtNumber(final String decimalFormat);  FmtNumber(final String decimalFormat, final StringCellProcessor next);  FmtNumber(final DecimalFormat formatter);  FmtNumber(final DecimalFormat formatter, final StringCellProcessor next); }
FmtNumber extends CellProcessorAdaptor implements DoubleCellProcessor, LongCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof Number) ) { throw new SuperCsvCellProcessorException(Number.class, value, context, this); } final DecimalFormat decimalFormatter; try { decimalFormatter = formatter != null ? formatter : new DecimalFormat(decimalFormat); } catch(IllegalArgumentException e) { throw new SuperCsvCellProcessorException( String.format("'%s' is not a valid decimal format", decimalFormat), context, this, e); } final String result = decimalFormatter.format(value); return next.execute(result, context); } FmtNumber(final String decimalFormat);  FmtNumber(final String decimalFormat, final StringCellProcessor next);  FmtNumber(final DecimalFormat formatter);  FmtNumber(final DecimalFormat formatter, final StringCellProcessor next); Object execute(final Object value, final CsvContext context); }
FmtNumber extends CellProcessorAdaptor implements DoubleCellProcessor, LongCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof Number) ) { throw new SuperCsvCellProcessorException(Number.class, value, context, this); } final DecimalFormat decimalFormatter; try { decimalFormatter = formatter != null ? formatter : new DecimalFormat(decimalFormat); } catch(IllegalArgumentException e) { throw new SuperCsvCellProcessorException( String.format("'%s' is not a valid decimal format", decimalFormat), context, this, e); } final String result = decimalFormatter.format(value); return next.execute(result, context); } FmtNumber(final String decimalFormat);  FmtNumber(final String decimalFormat, final StringCellProcessor next);  FmtNumber(final DecimalFormat formatter);  FmtNumber(final DecimalFormat formatter, final StringCellProcessor next); Object execute(final Object value, final CsvContext context);  }