package com.amee.platform.science;

import org.joda.time.DateTime;

import java.util.Date;

public abstract class BaseDate extends java.util.Date {

    protected String dateStr;

    public BaseDate(long time) {
        setTime(time);
        setDefaultDateStr();
    }

    public BaseDate(String dateStr) {
        super();
        if (dateStr != null) {
            setTime(parseStr(dateStr));
            this.dateStr = dateStr;
        } else {
            setTime(defaultDate());
            setDefaultDateStr();
        }
    }

    protected abstract long parseStr(String dateStr);

    protected abstract void setDefaultDateStr();

    protected abstract long defaultDate();

    public String toString() {
        return dateStr;
    }

    public DateTime toDateTime() {
        return new DateTime(this.getTime());
    }
}

package com.amee.platform.science;

import org.joda.time.DateTime;

import java.util.Date;

public abstract class BaseDate extends java.util.Date {

    protected String dateStr;

    public BaseDate(long time) {
        setTime(time);
        setDefaultDateStr();
    }

    public BaseDate(String dateStr) {
        super();
        if (dateStr != null) {
            setTime(parseStr(dateStr));
            this.dateStr = dateStr;
        } else {
            setTime(defaultDate());
            setDefaultDateStr();
        }
    }

    protected abstract long parseStr(String dateStr);

    protected abstract void setDefaultDateStr();

    protected abstract long defaultDate();

    public String toString() {
        return dateStr;
    }

    public DateTime toDateTime() {
        return new DateTime(this.getTime());
    }

    public Date toDate() {
        return new DateTime(this.getTime()).toDate();
    }
}

Revert "Removed unused method. PL-1321."
Revert "Removed unused method. PL-1321."

This reverts commit a43684f4c0f4753d6906ca6f7e1cf9409bc24488.
