01: /*
02: * JFolder, Copyright 2001-2006 Gary Steinmetz
03: *
04: * Distributable under LGPL license.
05: * See terms of license at gnu.org.
06: */
07:
08: package org.jfolder.common;
09:
10: //base classes
11: import java.io.PrintStream;
12: import java.io.PrintWriter;
13: import java.sql.Timestamp;
14:
15: //project specific classes
16:
17: //other classes
18:
19: public class ImmutableTimestamp {
20:
21: private Timestamp value = null;
22:
23: private ImmutableTimestamp(Timestamp inValue, boolean inClone) {
24: if (inClone) {
25: this .value = ((Timestamp) inValue.clone());
26: } else {
27: this .value = inValue;
28: }
29: }
30:
31: public final static ImmutableTimestamp newInstance(Timestamp inValue) {
32: return new ImmutableTimestamp(inValue, true);
33: }
34:
35: public Timestamp getValueAsTimestamp() {
36: return ((Timestamp) this .value.clone());
37: }
38:
39: public boolean equals(Object inObject) {
40:
41: boolean outValue = false;
42:
43: if (inObject != null && inObject instanceof ImmutableTimestamp) {
44: ImmutableTimestamp it = (ImmutableTimestamp) inObject;
45: outValue = this .value.equals(it.value);
46: }
47:
48: return outValue;
49: }
50:
51: public int hashCode() {
52: return this.value.hashCode();
53: }
54:
55: }
|