- java.lang.Object
-
- com.github.f4b6a3.ulid.UlidCreator
-
public final class UlidCreator extends Object
Facade to the ULID factories. The ULID has two components: - Time component: a part of 48 bits that represent the amount of milliseconds since Unix Epoch, 1970-01-01. - Random component: a byte array of 80 bits that has a random value generated a secure random generator. The maximum ULIDs that can be generated per millisecond is 2^80.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static UlidFactorygetDefaultFactory()Returns an instance of the Default ULID factory.static UlidFactorygetMonotonicFactory()Returns an instance of the Monotonic ULID factory.static UlidgetMonotonicUlid()Returns a Monotonic ULID.static UlidgetMonotonicUlid(long time)Returns a Monotonic ULID with a specific time.static UlidgetUlid()Returns a ULID.static UlidgetUlid(long time)Returns a ULID with a specific time.
-
-
-
Method Detail
-
getUlid
public static Ulid getUlid()
Returns a ULID. The random component is always reset to a new random value.- Returns:
- a ULID
-
getUlid
public static Ulid getUlid(long time)
Returns a ULID with a specific time.- Parameters:
time- a specific time- Returns:
- a ULID
-
getMonotonicUlid
public static Ulid getMonotonicUlid()
Returns a Monotonic ULID. The random component is reset to a new value every time the millisecond changes. If more than one ULID is generated within the same millisecond, the random component is incremented by one.- Returns:
- a ULID
-
getMonotonicUlid
public static Ulid getMonotonicUlid(long time)
Returns a Monotonic ULID with a specific time.- Parameters:
time- a specific time- Returns:
- a ULID
-
getDefaultFactory
public static UlidFactory getDefaultFactory()
Returns an instance of the Default ULID factory.- Returns:
- a ULID factory
-
getMonotonicFactory
public static UlidFactory getMonotonicFactory()
Returns an instance of the Monotonic ULID factory.- Returns:
- a ULID factory
-
-