public boolean equals(Timestamp that) { if (that == null) return false; boolean this_present_secsSinceEpoch = true; boolean that_present_secsSinceEpoch = true; if (this_present_secsSinceEpoch || that_present_secsSinceEpoch) { if (!(this_present_secsSinceEpoch && that_present_secsSinceEpoch)) return false; if (this.secsSinceEpoch != that.secsSinceEpoch) return false; } boolean this_present_nanos = true && this.isSetNanos(); boolean that_present_nanos = true && that.isSetNanos(); if (this_present_nanos || that_present_nanos) { if (!(this_present_nanos && that_present_nanos)) return false; if (this.nanos != that.nanos) return false; } return true; }
public static java.sql.Timestamp getTimestamp(Timestamp ts) { java.sql.Timestamp jts = new java.sql.Timestamp(ts.secsSinceEpoch); if (ts.isSetNanos()) { jts.setNanos(ts.nanos); } return jts; }
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case SECS_SINCE_EPOCH: return isSetSecsSinceEpoch(); case NANOS: return isSetNanos(); } throw new IllegalStateException(); }
@Override public String toString() { StringBuilder sb = new StringBuilder("Timestamp("); boolean first = true; sb.append("secsSinceEpoch:"); sb.append(this.secsSinceEpoch); first = false; if (isSetNanos()) { if (!first) sb.append(", "); sb.append("nanos:"); sb.append(this.nanos); first = false; } sb.append(")"); return sb.toString(); }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, Timestamp struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeI64(struct.secsSinceEpoch); BitSet optionals = new BitSet(); if (struct.isSetNanos()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetNanos()) { oprot.writeI32(struct.nanos); } }
public void write(org.apache.thrift.protocol.TProtocol oprot, Timestamp struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(SECS_SINCE_EPOCH_FIELD_DESC); oprot.writeI64(struct.secsSinceEpoch); oprot.writeFieldEnd(); if (struct.isSetNanos()) { oprot.writeFieldBegin(NANOS_FIELD_DESC); oprot.writeI32(struct.nanos); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
@Override public int compareTo(Timestamp other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetSecsSinceEpoch()).compareTo(other.isSetSecsSinceEpoch()); if (lastComparison != 0) { return lastComparison; } if (isSetSecsSinceEpoch()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.secsSinceEpoch, other.secsSinceEpoch); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetNanos()).compareTo(other.isSetNanos()); if (lastComparison != 0) { return lastComparison; } if (isSetNanos()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nanos, other.nanos); if (lastComparison != 0) { return lastComparison; } } return 0; }