@Override public int hashCode() { return getTime(); // note that Date.hashCode() calls Date.getTime(), so our approach works great }
@Override public int hashCode() { return getTime(); // note that Date.hashCode() calls Date.getTime(), so our approach works great }
protected void write( Timestamp value, Writer writer ) throws IOException { write(new BasicDocument(TIMESTAMP, value.getTime(), INCREMENT, value.getInc()), writer); }
protected void write( Timestamp value, Writer writer ) throws IOException { write(new BasicDocument(TIMESTAMP, value.getTime(), INCREMENT, value.getInc()), writer); }
protected void write( String name, Timestamp value, BsonDataOutput output ) { output.writeByte(Type.TIMESTAMP); writeCString(name, output); output.writeInt(value.getInc()); output.writeInt(value.getTime()); }
protected void write( String name, Timestamp value, BsonDataOutput output ) { output.writeByte(Type.TIMESTAMP); writeCString(name, output); output.writeInt(value.getInc()); output.writeInt(value.getTime()); }
@Test public void shouldCorrectlyWriteTimestamp() { Timestamp now = new Timestamp(new Date()); String expected = "{ \"$ts\" : " + now.getTime() + " , \"$inc\" : " + now.getInc() + " }"; String actual = writer.write(now); assertSame(expected, actual); }
} else if (value instanceof Timestamp) { Timestamp ts = (Timestamp)value; value = new de.undercouch.bson4jackson.types.Timestamp(ts.getTime(), ts.getInc()); } else if (value instanceof CodeWithScope) { CodeWithScope code = (CodeWithScope)value;
} else if (value instanceof Timestamp) { Timestamp ts = (Timestamp)value; value = new BSONTimestamp(ts.getTime(), ts.getInc()); } else if (value instanceof CodeWithScope) { CodeWithScope code = (CodeWithScope)value;