Package org.bson

Class BsonObjectId

  • All Implemented Interfaces:
    java.lang.Comparable<BsonObjectId>

    public class BsonObjectId
    extends BsonValue
    implements java.lang.Comparable<BsonObjectId>
    A representation of the BSON ObjectId type.
    Since:
    3.0
    • Constructor Detail

      • BsonObjectId

        public BsonObjectId()
        Construct a new instance with a new ObjectId.
      • BsonObjectId

        public BsonObjectId​(ObjectId value)
        Construct a new instance with the given ObjectId instance.
        Parameters:
        value - the ObjectId
    • Method Detail

      • getValue

        public ObjectId getValue()
        Get the ObjectId value.
        Returns:
        the ObjectId value
      • getBsonType

        public BsonType getBsonType()
        Description copied from class: BsonValue
        Gets the BSON type of this value.
        Specified by:
        getBsonType in class BsonValue
        Returns:
        the BSON type, which may not be null (but may be BSONType.NULL)
      • compareTo

        public int compareTo​(BsonObjectId o)
        Specified by:
        compareTo in interface java.lang.Comparable<BsonObjectId>
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

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