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

tech.tablesaw.columns.instant.InstantParser Maven / Gradle / Ivy

There is a newer version: 0.43.1
Show newest version
package tech.tablesaw.columns.instant;

import java.time.Instant;

import tech.tablesaw.api.ColumnType;
import tech.tablesaw.columns.AbstractColumnParser;

public class InstantParser extends AbstractColumnParser {

    public InstantParser(ColumnType columnType) {
        super(columnType);
    }

    @Override
    public boolean canParse(String s) {
        if (isMissing(s)) {
            return true;
        }
        try {
            parse(s);
            return true;
        } catch (RuntimeException e) {
            return false;
        }
    }

    @Override
    public Instant parse(String value) {
        return Instant.parse(value);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy