org.simpleflatmapper.converter.impl.time.MultiDateTimeFormatterConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-converter Show documentation
Show all versions of sfm-converter Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.simpleflatmapper.converter.impl.time;
import org.simpleflatmapper.converter.Converter;
import java.time.format.DateTimeParseException;
public class MultiDateTimeFormatterConverter implements Converter {
private final Converter[] converters;
public MultiDateTimeFormatterConverter(Converter[] converters) {
this.converters = converters;
}
@Override
public O convert(I in) throws Exception {
for(int i = converters.length - 1; i >= 0; i--) {
Converter converter = converters[i];
try {
return converter.convert(in);
} catch (DateTimeParseException e) {
// ignore
}
}
throw new DateTimeParseException("Unable to parse " + in, String.valueOf(in), 0);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy