Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

read CSV file and map it to bean java

@NoArgsConstructor
public class ZoneDateTimeConverter extends AbstractBeanField {

    @Override
    protected Object convert(String value) throws CsvDataTypeMismatchException, CsvConstraintViolationException {

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss X");
        return ZonedDateTime.parse(value, formatter);
    }

}
Source by sunitc.dev #
 
PREVIOUS NEXT
Tagged: #read #CSV #file #map #bean #java
ADD COMMENT
Topic
Name
1+6 =