org.simpleflatmapper.converter.joda.impl.MultiDateTimeFormatterConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-converter-joda-time Show documentation
Show all versions of sfm-converter-joda-time Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.simpleflatmapper.converter.joda.impl;
import org.simpleflatmapper.converter.Converter;
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 (IllegalArgumentException e) {
// ignore
}
}
throw new IllegalArgumentException("Unable to parse " + in);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy