Class SnowflakeCreatorBuilder
java.lang.Object
de.chojo.jdautil.util.SnowflakeCreatorBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()withCustomEpoch(long customEpoch) Sets a custom offset for the epoch millis.withCustomEpoch(Instant offset) Sets a custom offset for the epoch millis.withCustomEpoch(ZonedDateTime offset) Sets a custom offset for the epoch millis.withProcessId(long processId) Set the process id for the creator.withWorkerId(long workerId) Set the worker id for the creator.
-
Constructor Details
-
SnowflakeCreatorBuilder
public SnowflakeCreatorBuilder()
-
-
Method Details
-
withWorkerId
Set the worker id for the creator. This id is usually the same for each running application instance- Parameters:
workerId- worker id- Returns:
- builder instance
- Throws:
IllegalStateException- when the id is larger than the max id or smaller than 0
-
withProcessId
Set the process id for the creator. If the id is not set a auto incremental id will be used which is unique for the worker.- Parameters:
processId- process id- Returns:
- builder instance
- Throws:
IllegalStateException- when the id is larger than the max id or smaller than 0
-
withCustomEpoch
Sets a custom offset for the epoch millis.Default is the
January 1, 2015 Midnight UTC = 2015-01-01T00:00:00Z- Parameters:
customEpoch- custom offset.- Returns:
- builder instance
-
withCustomEpoch
Sets a custom offset for the epoch millis.Default is the
January 1, 2015 Midnight UTC = 2015-01-01T00:00:00Z- Parameters:
offset- custom offset.- Returns:
- builder instance
-
withCustomEpoch
Sets a custom offset for the epoch millis.Default is the
January 1, 2015 Midnight UTC = 2015-01-01T00:00:00Z- Parameters:
offset- custom offset.- Returns:
- builder instance
-
build
-