Package org.bson
Class BsonTimestamp
- java.lang.Object
- 
- org.bson.BsonValue
- 
- org.bson.BsonTimestamp
 
 
- 
- All Implemented Interfaces:
- Comparable<BsonTimestamp>
 
 public final class BsonTimestamp extends BsonValue implements Comparable<BsonTimestamp> A value representing the BSON timestamp type.- Since:
- 3.0
 
- 
- 
Constructor SummaryConstructors Constructor Description BsonTimestamp()Construct a new instance with a null time and a 0 increment.BsonTimestamp(int seconds, int increment)Construct a new instance for the given time and increment.BsonTimestamp(long value)Construct a new instance for the given value, which combines the time in seconds and the increment as a single long value.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(BsonTimestamp ts)booleanequals(Object o)BsonTypegetBsonType()Gets the BSON type of this value.intgetInc()Gets the increment value.intgetTime()Gets the time in seconds since epoch.longgetValue()Gets the value of the timestamp.inthashCode()StringtoString()- 
Methods inherited from class org.bson.BsonValueasArray, asBinary, asBoolean, asDateTime, asDBPointer, asDecimal128, asDocument, asDouble, asInt32, asInt64, asJavaScript, asJavaScriptWithScope, asNumber, asObjectId, asRegularExpression, asString, asSymbol, asTimestamp, isArray, isBinary, isBoolean, isDateTime, isDBPointer, isDecimal128, isDocument, isDouble, isInt32, isInt64, isJavaScript, isJavaScriptWithScope, isNull, isNumber, isObjectId, isRegularExpression, isString, isSymbol, isTimestamp
 
- 
 
- 
- 
- 
Constructor Detail- 
BsonTimestamppublic BsonTimestamp() Construct a new instance with a null time and a 0 increment.
 - 
BsonTimestamppublic BsonTimestamp(long value) Construct a new instance for the given value, which combines the time in seconds and the increment as a single long value.- Parameters:
- value- the timetamp as a single long value
- Since:
- 3.5
 
 - 
BsonTimestamppublic BsonTimestamp(int seconds, int increment)Construct a new instance for the given time and increment.- Parameters:
- seconds- the number of seconds since the epoch
- increment- the increment.
 
 
- 
 - 
Method Detail- 
getBsonTypepublic BsonType getBsonType() Description copied from class:BsonValueGets the BSON type of this value.- Specified by:
- getBsonTypein class- BsonValue
- Returns:
- the BSON type, which may not be null (but may be BSONType.NULL)
 
 - 
getValuepublic long getValue() Gets the value of the timestamp.- Returns:
- the timestamp value
- Since:
- 3.5
 
 - 
getTimepublic int getTime() Gets the time in seconds since epoch.- Returns:
- an int representing time in seconds since epoch
 
 - 
getIncpublic int getInc() Gets the increment value.- Returns:
- an incrementing ordinal for operations within a given second
 
 - 
compareTopublic int compareTo(BsonTimestamp ts) - Specified by:
- compareToin interface- Comparable<BsonTimestamp>
 
 
- 
 
-