提交 7fefdea5 authored 作者: Thomas Mueller Graf's avatar Thomas Mueller Graf

Code cleanup; add serial version id

上级 0e9a7854
...@@ -9,17 +9,21 @@ import java.sql.Timestamp; ...@@ -9,17 +9,21 @@ import java.sql.Timestamp;
/** /**
* Extends java.sql.Timestamp to add our time zone information. * Extends java.sql.Timestamp to add our time zone information.
*
*/ */
public class TimestampWithTimeZone extends Timestamp { public class TimestampWithTimeZone extends Timestamp {
/**
* The serial version UID.
*/
private static final long serialVersionUID = 4413229090646777107L;
/** /**
* Time zone offset from UTC in minutes, range of -12hours to +12hours * Time zone offset from UTC in minutes, range of -12hours to +12hours
*/ */
private final short timeZoneOffsetMins; private final short timeZoneOffsetMins;
public TimestampWithTimeZone(long time_ms, int nanos, short timeZoneOffsetMins) { public TimestampWithTimeZone(long timeMillis, int nanos, short timeZoneOffsetMins) {
super(time_ms); super(timeMillis);
setNanos(nanos); setNanos(nanos);
this.timeZoneOffsetMins = timeZoneOffsetMins; this.timeZoneOffsetMins = timeZoneOffsetMins;
} }
...@@ -43,15 +47,19 @@ public class TimestampWithTimeZone extends Timestamp { ...@@ -43,15 +47,19 @@ public class TimestampWithTimeZone extends Timestamp {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj) {
return true; return true;
if (!super.equals(obj)) }
if (!super.equals(obj)) {
return false; return false;
if (getClass() != obj.getClass()) }
if (getClass() != obj.getClass()) {
return false; return false;
}
TimestampWithTimeZone other = (TimestampWithTimeZone) obj; TimestampWithTimeZone other = (TimestampWithTimeZone) obj;
if (timeZoneOffsetMins != other.timeZoneOffsetMins) if (timeZoneOffsetMins != other.timeZoneOffsetMins) {
return false; return false;
}
return true; return true;
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论