public class ObjectID extends Object implements Comparable<ObjectID>, Serializable
由12个字节组成,分割如下:
| Constructor and Description |
|---|
ObjectID()
Create a new object id.
|
ObjectID(byte[] b) |
ObjectID(Date time) |
ObjectID(Date time,
int inc) |
ObjectID(Date time,
int machine,
int inc) |
ObjectID(int time,
int machine,
int inc)
Creates an ObjectId
|
ObjectID(String s)
Creates a new instance from a string.
|
ObjectID(String s,
boolean babble) |
| Modifier and Type | Method and Description |
|---|---|
static int |
_flip(int x) |
int |
_inc() |
int |
_machine() |
int |
_time() |
static String |
babbleToMongod(String b) |
int |
compareTo(ObjectID id) |
boolean |
equals(Object o) |
static ObjectID |
get()
获取ObjectId
|
static int |
getCurrentInc()
获取自动增量的当前值
|
static int |
getGenMachineId()
获取生成的机器ID,标识机器/进程/类 加载程序
|
int |
getInc() |
int |
getMachine() |
long |
getTime()
获取此ID的时间(以毫秒为单位)
|
int |
getTimeSecond()
获取此ID的时间(以秒为单位)
|
int |
hashCode() |
static String |
id()
获取ObjectId.
|
boolean |
isNew() |
static boolean |
isValid(String text)
检查字符串是否可以是ObjectId
|
static ObjectID |
massageToObjectId(Object o)
将对象转换为ObjectId
|
void |
notNew() |
byte[] |
toByteArray() |
String |
toString() |
String |
toStringBabble() |
String |
toStringMongod() |
public ObjectID(Date time)
public ObjectID(Date time, int inc)
public ObjectID(Date time, int machine, int inc)
public ObjectID(String s)
s - the string to convertIllegalArgumentException - if the string is not a valid idpublic ObjectID(String s, boolean babble)
public ObjectID(byte[] b)
public ObjectID(int time,
int machine,
int inc)
time - time in secondsmachine - machine IDinc - incremental valuepublic ObjectID()
public static String id()
public static ObjectID get()
public static boolean isValid(String text)
text - 字符串public static ObjectID massageToObjectId(Object o)
o - 要转换的对象public static int getGenMachineId()
public static int getCurrentInc()
public static int _flip(int x)
public String toStringBabble()
public String toStringMongod()
public byte[] toByteArray()
public int compareTo(ObjectID id)
compareTo in interface Comparable<ObjectID>public int getMachine()
public long getTime()
public int getTimeSecond()
public int getInc()
public int _time()
public int _machine()
public int _inc()
public boolean isNew()
public void notNew()
Copyright © 2019. All rights reserved.