Package de.huxhorn.sulky.ulid
Class ULID
- java.lang.Object
-
- de.huxhorn.sulky.ulid.ULID
-
public class ULID extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classULID.Value
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendULID(java.lang.StringBuilder stringBuilder)static ULID.ValuefromBytes(byte[] data)ULID.ValuenextMonotonicValue(ULID.Value previousUlid)Returns the next monotonic value.ULID.ValuenextMonotonicValue(ULID.Value previousUlid, long timestamp)Returns the next monotonic value.java.util.Optional<ULID.Value>nextStrictlyMonotonicValue(ULID.Value previousUlid)Returns the next monotonic value or empty if an overflow happened while incrementing the random part of the given previous ULID value.java.util.Optional<ULID.Value>nextStrictlyMonotonicValue(ULID.Value previousUlid, long timestamp)Returns the next monotonic value or empty if an overflow happened while incrementing the random part of the given previous ULID value.java.lang.StringnextULID()java.lang.StringnextULID(long timestamp)ULID.ValuenextValue()ULID.ValuenextValue(long timestamp)static ULID.ValueparseULID(java.lang.String ulidString)
-
-
-
Method Detail
-
appendULID
public void appendULID(java.lang.StringBuilder stringBuilder)
-
nextULID
public java.lang.String nextULID()
-
nextULID
public java.lang.String nextULID(long timestamp)
-
nextValue
public ULID.Value nextValue()
-
nextValue
public ULID.Value nextValue(long timestamp)
-
nextMonotonicValue
public ULID.Value nextMonotonicValue(ULID.Value previousUlid)
Returns the next monotonic value. If an overflow happened while incrementing the random part of the given previous ULID value then the returned value will have a zero random part.- Parameters:
previousUlid- the previous ULID value.- Returns:
- the next monotonic value.
-
nextMonotonicValue
public ULID.Value nextMonotonicValue(ULID.Value previousUlid, long timestamp)
Returns the next monotonic value. If an overflow happened while incrementing the random part of the given previous ULID value then the returned value will have a zero random part.- Parameters:
previousUlid- the previous ULID value.timestamp- the timestamp of the next ULID value.- Returns:
- the next monotonic value.
-
nextStrictlyMonotonicValue
public java.util.Optional<ULID.Value> nextStrictlyMonotonicValue(ULID.Value previousUlid)
Returns the next monotonic value or empty if an overflow happened while incrementing the random part of the given previous ULID value.- Parameters:
previousUlid- the previous ULID value.- Returns:
- the next monotonic value or empty if an overflow happened.
-
nextStrictlyMonotonicValue
public java.util.Optional<ULID.Value> nextStrictlyMonotonicValue(ULID.Value previousUlid, long timestamp)
Returns the next monotonic value or empty if an overflow happened while incrementing the random part of the given previous ULID value.- Parameters:
previousUlid- the previous ULID value.timestamp- the timestamp of the next ULID value.- Returns:
- the next monotonic value or empty if an overflow happened.
-
parseULID
public static ULID.Value parseULID(java.lang.String ulidString)
-
fromBytes
public static ULID.Value fromBytes(byte[] data)
-
-