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

io.mstream.trader.commons.test.util.date.DateFormatter Maven / Gradle / Ivy

There is a newer version: 1.14
Show newest version
package io.mstream.trader.commons.test.util.date;

import io.mstream.trader.commons.test.Feature;
import io.mstream.trader.commons.test.Service;
import io.mstream.trader.commons.test.Yahoo;

import javax.inject.Inject;
import java.time.format.DateTimeFormatter;

public class DateFormatter {

    private final DateTimeFormatter featureDateFormatter;
    private final DateTimeFormatter serviceDateFormatter;
    private final DateTimeFormatter yahooDateFormatter;

    @Inject
    public DateFormatter(
            @Feature DateTimeFormatter featureDateFormatter,
            @Service DateTimeFormatter serviceDateFormatter,
            @Yahoo DateTimeFormatter yahooDateFormatter) {
        this.featureDateFormatter = featureDateFormatter;
        this.serviceDateFormatter = serviceDateFormatter;
        this.yahooDateFormatter = yahooDateFormatter;
    }

    public String featureToServiceDate(String featureDate) {
        return serviceDateFormatter.format(featureDateFormatter.parse(featureDate));
    }

    public String featureToYahooDate(String featureDate) {
        return yahooDateFormatter.format(featureDateFormatter.parse(featureDate));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy