0

I have following CellProcessor method

private static CellProcessor[] getProcessors() {

    final CellProcessor[] processors = new CellProcessor[] { 
            new NotNull(), // senderId
            new NotNull(), // orderId
            new NotNull(), // execQuantity
            new NotNull(), // execPrice <~~~~~~~~~~~~
            new NotNull(new FmtDate("yyyy-MM-dd")), // deliveryDate
    };

    return processors;
}

As execPrice is Double, output csv file contains decimal values. It has to be double type in bean. I need to change it when writing csv file.

How do I remove decimal values (or convert to integer) in supercsv? I think I have to use FmtNumber in CellProcessor but I don't know how.

Min Naing Oo
  • 1,085
  • 5
  • 24
  • 49

1 Answers1

1
private static CellProcessor[] getProcessors() {

    DecimalFormat df = new DecimalFormat();
    df.applyPattern("#");

    final CellProcessor[] processors = new CellProcessor[] { 
            new NotNull(), // senderId
            new NotNull(), // orderId
            new NotNull(), // execQuantity
            new NotNull(new ParseDouble(new FmtNumber(df))), // execPrice <~~~~~~
            new NotNull(new FmtDate("yyyy-MM-dd")), // deliveryDate
    };

    return processors;
}

Above code worked in case someone with same situation like me might wanna know.

Min Naing Oo
  • 1,085
  • 5
  • 24
  • 49