Class BSONTimestamp

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<BSONTimestamp>

    public final class BSONTimestamp
    extends java.lang.Object
    implements java.lang.Comparable<BSONTimestamp>, java.io.Serializable
    This is used for internal increment values. For normal dates you should use java.util.Date time is seconds since epoch inc is an ordinal.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      BSONTimestamp()
      Creates a new instance.
      BSONTimestamp​(int time, int increment)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(BSONTimestamp ts)  
      boolean equals​(java.lang.Object obj)  
      int getInc()
      Gets the incrementing ordinal for operations within a given second.
      int getTime()
      Gets the time in seconds since epoch
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BSONTimestamp

        public BSONTimestamp()
        Creates a new instance.
      • BSONTimestamp

        public BSONTimestamp​(int time,
                             int increment)
        Creates a new instance.
        Parameters:
        time - the time in seconds since epoch
        increment - an incrementing ordinal for operations within a given second
    • Method Detail

      • getTime

        public int getTime()
        Gets the time in seconds since epoch
        Returns:
        an int representing time in seconds since epoch
      • getInc

        public int getInc()
        Gets the incrementing ordinal for operations within a given second.
        Returns:
        the increment ordinal
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • compareTo

        public int compareTo​(BSONTimestamp ts)
        Specified by:
        compareTo in interface java.lang.Comparable<BSONTimestamp>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object