public class UniqueId extends Object
Constructor and Description |
---|
UniqueId()
构造函数
|
UniqueId(int signId)
构造函数
|
UniqueId(int signId,
int step)
构造函数
|
Modifier and Type | Method and Description |
---|---|
static long |
adjust(long id,
Integer adjustMills,
Integer sequence) |
static long |
adjust(String uniqueId,
Integer adjustMills,
Integer sequence) |
static long |
generateId(long timeMills,
int signId,
int sequence)
生成带顺序的 ID 序列
|
static Long |
getMillis(Long uniqueId) |
static Long |
getMillis(String uniqueId) |
long |
getNumber(Long timeMills)
获取指定时间的 id
|
static Integer |
getSequence(Long uniqueId) |
static Integer |
getSequence(String uniqueId) |
static Integer |
getSignId(Long uniqueId) |
static Integer |
getSignId(String uniqueId) |
String |
getString(Long timeMills)
获取指定时间的 id
|
long |
nextNumber()
获取下一个 id
|
String |
nextString()
获取下一个 id
|
public UniqueId()
public UniqueId(int signId)
signId
- 标识 IDpublic UniqueId(int signId, int step)
signId
- 标识 IDstep
- 每次自增的步长public long nextNumber()
public String nextString()
public static long generateId(long timeMills, int signId, int sequence)
timeMills
- 时间戳signId
- 种子idsequence
- 序号public long getNumber(Long timeMills)
timeMills
- 指定的时间, 毫秒public String getString(Long timeMills)
timeMills
- 指定的时间, 毫秒Copyright © 2020 Voovan. All rights reserved.