org.supercsv.ext.cellprocessor.ParseLocaleTimestamp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of super-csv-annotation Show documentation
Show all versions of super-csv-annotation Show documentation
CSVのJavaライブラリであるSuperCSVに、アノテーション機能を追加したライブラリです。
/*
* ParseLocaleTimestamp.java
* created in 2013/03/06
*
* (C) Copyright 2003-2013 GreenDay Project. All rights reserved.
*/
package org.supercsv.ext.cellprocessor;
import java.sql.Timestamp;
import java.text.ParseException;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import org.supercsv.cellprocessor.ift.DateCellProcessor;
/**
*
* @author T.TSUCHIE
*
*/
public class ParseLocaleTimestamp extends ParseLocaleDate {
public ParseLocaleTimestamp(final String format) {
this(format, true, null, null);
}
public ParseLocaleTimestamp(final String format, final DateCellProcessor next) {
this(format, true, null, null, next);
}
public ParseLocaleTimestamp(final String pattern, final boolean lenient) {
this(pattern, lenient, Locale.getDefault(), null);
}
public ParseLocaleTimestamp(final String pattern, final boolean lenient, final DateCellProcessor next) {
this(pattern, lenient, Locale.getDefault(), null, next);
}
public ParseLocaleTimestamp(final String format, final boolean lenient, final Locale locale, final TimeZone timeZone) {
super(format, lenient, locale, timeZone);
}
public ParseLocaleTimestamp(final String format, final boolean lenient, final Locale locale, final TimeZone timeZone, final DateCellProcessor next) {
super(format, lenient, locale, timeZone, next);
}
@Override
protected Object parse(final String value) throws ParseException {
final Date result = formatter.get().parse(value);
return new Timestamp(result.getTime());
}
}