ComputedDateValue.java :  » Database-Client » LiquiBase » liquibase » database » sql » Java Open Source

Java Open Source » Database Client » LiquiBase 
LiquiBase » liquibase » database » sql » ComputedDateValue.java
package liquibase.database.sql;

import java.util.Date;

public class ComputedDateValue extends Date {

    private String value;

    public ComputedDateValue(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }


    public long getTime() {
        throw new RuntimeException("Date computed by database");
    }

    public String toString() {
        return getValue();
    }

    public boolean equals(Object obj) {
        if (obj instanceof ComputedDateValue) {
            return this.toString().equals(obj.toString());
        } else {
            return super.equals(obj);
        }
    }

    public int hashCode() {
        return this.toString().hashCode();
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.