|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mongodb.ObjectId
public class ObjectId
A globally unique identifier for objects.
Consists of 12 bytes, divided as follows:
0 1 2 3 4 5 6 7 8 9 10 11 time machine pid inc
Constructor Summary | |
---|---|
ObjectId()
Create a new object id. |
|
ObjectId(byte[] b)
|
|
ObjectId(Date time)
|
|
ObjectId(Date time,
int inc)
|
|
ObjectId(String s)
Creates a new instance from a string. |
|
ObjectId(String s,
boolean babble)
|
Method Summary | |
---|---|
static String |
babbleToMongod(String b)
|
int |
compareTo(ObjectId id)
|
boolean |
equals(Object o)
|
static ObjectId |
get()
Gets a new object id. |
int |
getInc()
|
int |
getMachine()
|
long |
getTime()
|
int |
hashCode()
|
static boolean |
isValid(String s)
Checks if a string could be an ObjectId . |
static void |
main(String[] args)
|
static ObjectId |
massageToObjectId(Object o)
Turn an object into an ObjectId , if possible. |
byte[] |
toByteArray()
|
String |
toString()
|
String |
toStringBabble()
|
String |
toStringMongod()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ObjectId(Date time)
public ObjectId(Date time, int inc)
public ObjectId(String s)
s
- the string to convert
IllegalArgumentException
- if the string is not a valid idpublic ObjectId(String s, boolean babble)
public ObjectId(byte[] b)
public ObjectId()
Method Detail |
---|
public static ObjectId get()
public static boolean isValid(String s)
ObjectId
.
public static ObjectId massageToObjectId(Object o)
ObjectId
, if possible.
Strings will be converted into ObjectId
s, if possible, and ObjectId
s will
be cast and returned. Passing in null
returns null
.
o
- the object to convert
ObjectId
if it can be massaged, null otherwisepublic int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
public String toStringBabble()
public String toStringMongod()
public byte[] toByteArray()
public static String babbleToMongod(String b)
public String toString()
toString
in class Object
public int compareTo(ObjectId id)
compareTo
in interface Comparable<ObjectId>
public int getMachine()
public long getTime()
public int getInc()
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |