- java.lang.Object
-
- com.github.f4b6a3.uuid.codec.UrnCodec
-
-
Constructor Summary
Constructors Constructor Description UrnCodec()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description UUIDdecode(String urn)Get a UUID from a URN string.Stringencode(UUID uuid)Get a URN string from a UUID.static booleanisUuidUrn(String urn)Check if a URN string is a UUID URN.
-
-
-
Field Detail
-
INSTANCE
public static final UrnCodec INSTANCE
A shared immutable instance.
-
-
Method Detail
-
encode
public String encode(UUID uuid)
Get a URN string from a UUID.- Specified by:
encodein interfaceUuidCodec<String>- Parameters:
uuid- a UUID- Returns:
- a URN string
- Throws:
InvalidUuidException- if the argument is invalid
-
decode
public UUID decode(String urn)
Get a UUID from a URN string.- Specified by:
decodein interfaceUuidCodec<String>- Parameters:
urn- a URN string- Returns:
- a UUID
- Throws:
InvalidUuidException- if the argument is invalid
-
isUuidUrn
public static boolean isUuidUrn(String urn)
Check if a URN string is a UUID URN.- Parameters:
urn- a string- Returns:
- true if the it's a URN
-
-