style(guid): The constructor parameters order of SnowflakeGuidCreator has been adjusted.

BREAKING CHANGE: Original order: long startEpoch, long workerId, long
dataCentreId
New order: long workerId, long dataCentreId, long
startEpoch
This commit is contained in:
Zihlu Wang
2023-08-01 19:02:28 +08:00
parent 1370ed4e77
commit 7c1082ca71
@@ -103,7 +103,7 @@ public final class SnowflakeGuidCreator implements GuidCreator<Long> {
* @param dataCentreId the data center ID (between 0 and 31). * @param dataCentreId the data center ID (between 0 and 31).
*/ */
public SnowflakeGuidCreator(long workerId, long dataCentreId) { public SnowflakeGuidCreator(long workerId, long dataCentreId) {
this(DEFAULT_CUSTOM_EPOCH, workerId, dataCentreId); this(workerId, dataCentreId, DEFAULT_CUSTOM_EPOCH);
} }
/** /**
@@ -118,7 +118,7 @@ public final class SnowflakeGuidCreator implements GuidCreator<Long> {
* current timestamp, or if the worker ID * current timestamp, or if the worker ID
* or data center ID is out of range * or data center ID is out of range
*/ */
public SnowflakeGuidCreator(long startEpoch, long workerId, long dataCentreId) { public SnowflakeGuidCreator(long workerId, long dataCentreId, long startEpoch) {
if (startEpoch > currentTimestamp()) { if (startEpoch > currentTimestamp()) {
throw new IllegalArgumentException("Start Epoch can not be greater than current timestamp!"); throw new IllegalArgumentException("Start Epoch can not be greater than current timestamp!");
} }