All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.supercsv.ext.cellprocessor.ParseLocaleTimestamp Maven / Gradle / Ivy

Go to download

CSVのJavaライブラリであるSuperCSVに、アノテーション機能を追加したライブラリです。

There is a newer version: 2.3
Show newest version
/*
 * 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());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy