public class ObjectId extends Object implements Serializable, Comparable<ObjectId>
Modifier and Type | Field and Description |
---|---|
static long |
MACHINE_ID
The current process's machine id.
|
Constructor and Description |
---|
ObjectId()
Constructs a new
ObjectId . |
ObjectId(int timestamp,
long machineId)
Constructs a new
ObjectId . |
ObjectId(String hexBytes)
Constructs a new
ObjectId . |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ObjectId other) |
boolean |
equals(Object object)
Determines if the passed object is of this same type as this object and
if so that its fields are equal.
|
int |
getCounterField()
The low 3 byte value of the machine id.
|
long |
getMachineId()
The lower 8 bytes of the object id.
|
int |
getMachineIdentifier()
The upper 3 bytes in the machine id.
|
int |
getPidField()
Middle 2 byte process id field from the machine id.
|
int |
getTimestamp()
The upper 4 bytes of the object id.
|
int |
hashCode()
Computes a reasonable hash code.
|
String |
toHexString()
Returns the HEX string form of the ObjectId.
|
String |
toString()
String form of the object.
|
public ObjectId()
ObjectId
.public ObjectId(int timestamp, long machineId)
ObjectId
.timestamp
- The BSON Object Id timestamp.machineId
- The BSON Object Id machine id.public ObjectId(String hexBytes) throws IllegalArgumentException
ObjectId
.hexBytes
- The hex encoded byte value.IllegalArgumentException
- If the hex encoded string is not 24 characters.public int compareTo(ObjectId other)
Overridden to compare the object ids based on the tuple (timestamp, machineId).
compareTo
in interface Comparable<ObjectId>
public boolean equals(Object object)
equals
in class Object
object
- The object to compare to.Object.equals(java.lang.Object)
public int getCounterField()
public long getMachineId()
public int getMachineIdentifier()
public int getPidField()
public int getTimestamp()
public int hashCode()
public String toHexString()
public String toString()
toString
in class Object
Object.toString()
Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.