Class CUID
java.lang.Object
icu.congee.id.generator.cuid.CUID
- All Implemented Interfaces:
Serializable,Comparable<CUID>
Collision-resistant ID optimized for horizontal scaling and performance.
- Since:
- 1.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintbooleanReturnstrueif the argument is equal to current object,falseotherwise.static CUIDfromString(String cuidAsString) Creates aCUIDfrom the string standard representation.inthashCode()Generates a hash code.static booleanChecks theCUIDfrom the string standard representation.static CUIDGenerates a new random CUID (Version 1).static CUIDGenerates a new random CUID (Version 2).static CUIDrandomCUID2(int length) Generates a new random CUID (Version 2).toString()Returns the string representation.
-
Method Details
-
randomCUID2
Generates a new random CUID (Version 2).- Returns:
- Newly generated CUID (Version 2)
- Since:
- 2.0.0
-
randomCUID2
Generates a new random CUID (Version 2).- Parameters:
length- requested CUID length- Returns:
- Newly generated CUID (Version 2)
- Since:
- 2.0.1
-
randomCUID1
Generates a new random CUID (Version 1).- Returns:
- Newly generated CUID (Version 1)
- Since:
- 2.0.0
-
fromString
Creates aCUIDfrom the string standard representation.- Parameters:
cuidAsString- A string that specifies aCUID(Version 1 or 2)- Returns:
- A
CUIDwith the specified value - Throws:
IllegalArgumentException- If the string is not conform- Since:
- 1.0.0
-
isValid
Checks theCUIDfrom the string standard representation.- Parameters:
cuidAsString- A string that specifies aCUID(Version 1 or 2)- Returns:
trueIf the string is conforms, otherwise,false- Since:
- 1.0.0
-
compareTo
- Specified by:
compareToin interfaceComparable<CUID>- Since:
- 1.0.0
-
toString
-
equals
-
hashCode
-