Package org.aoju.bus.core.key
Class ObjectID
java.lang.Object
org.aoju.bus.core.key.ObjectID
- All Implemented Interfaces:
Serializable,Comparable<ObjectID>
对象的全局唯一标识符 由12个字节组成,分割如下:
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int_flip(int x) int_inc()int_machine()int_time()static Stringintbooleanstatic ObjectIDget()获取ObjectIdstatic int获取自动增量的当前值static int获取生成的机器ID,标识机器/进程/类 加载程序intgetInc()intlonggetTime()获取此ID的时间(以毫秒为单位)int获取此ID的时间(以秒为单位)inthashCode()static Stringid()获取ObjectId.booleanisNew()static boolean检查字符串是否可以是ObjectIdstatic ObjectID将对象转换为ObjectIdvoidnotNew()byte[]toString()
-
Constructor Details
-
ObjectID
-
ObjectID
-
ObjectID
-
ObjectID
Creates a new instance from a string.- Parameters:
s- the string to convert- Throws:
IllegalArgumentException- if the string is not a valid id
-
ObjectID
-
ObjectID
public ObjectID(byte[] b) -
ObjectID
public ObjectID(int time, int machine, int inc) Creates an ObjectId- Parameters:
time- time in secondsmachine- machine IDinc- incremental value
-
ObjectID
public ObjectID()Create a new object id.
-
-
Method Details
-
id
-
get
-
isValid
检查字符串是否可以是ObjectId- Parameters:
text- 字符串- Returns:
- true/false
-
massageToObjectId
-
babbleToMongod
-
getGenMachineId
public static int getGenMachineId()获取生成的机器ID,标识机器/进程/类 加载程序- Returns:
- the int
-
getCurrentInc
public static int getCurrentInc()获取自动增量的当前值- Returns:
- the int
-
_flip
public static int _flip(int x) -
hashCode
-
equals
-
toStringBabble
-
toStringMongod
-
toByteArray
public byte[] toByteArray() -
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<ObjectID>
-
getMachine
public int getMachine() -
getTime
public long getTime()获取此ID的时间(以毫秒为单位)- Returns:
- the long
-
getTimeSecond
public int getTimeSecond()获取此ID的时间(以秒为单位)- Returns:
- the int
-
getInc
public int getInc() -
_time
public int _time() -
_machine
public int _machine() -
_inc
public int _inc() -
isNew
public boolean isNew() -
notNew
public void notNew()
-