Package de.fxlae.typeid
Class TypeId
java.lang.Object
de.fxlae.typeid.TypeId
An implementation of TypeID for Java.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic TypeIdgenerate()Creates a newTypeIdwithout prefix, based on UUIDv7.static TypeIdCreates a new prefixedTypeIdbased on UUIDv7.Returns the prefix of thisTypeId.getUuid()inthashCode()static TypeIdstatic TypeIdstatic TypeIdParses the textual representation of a TypeID and returns aTypeIdinstance.toString()Returns the textual representation of thisTypeId.
-
Method Details
-
getPrefix
Returns the prefix of thisTypeId.- Returns:
- the prefix.
-
getUuid
- Returns:
- the
UUID.
-
generate
Creates a new prefixedTypeIdbased on UUIDv7.- Parameters:
prefix- the prefix to use.- Returns:
- the new
TypeId. - Throws:
IllegalArgumentException
-
generate
Creates a newTypeIdwithout prefix, based on UUIDv7.Note: "no prefix" means empty string, not null.
- Returns:
- the new
TypeId.
-
of
Creates a newTypeIdwithout prefix, based on the givenUUID.The
UUIDcan be of any version.Note: "no prefix" means empty string, not null.
- Parameters:
uuid- theUUIDto use.- Returns:
- the new
TypeId. - Throws:
IllegalArgumentException
-
of
- Parameters:
prefix- the prefix to use.uuid- theUUIDto use.- Returns:
- the new
TypeId. - Throws:
IllegalArgumentException
-
parse
Parses the textual representation of a TypeID and returns aTypeIdinstance.- Parameters:
text- the textual representation.- Returns:
- the new
TypeId. - Throws:
IllegalArgumentException
-
toString
Returns the textual representation of thisTypeId. -
equals
-
hashCode
public int hashCode()
-