Package com.io7m.waxmill.machines
Class WXMShortIDs
java.lang.Object
com.io7m.waxmill.machines.WXMShortIDs
public final class WXMShortIDs
extends java.lang.Object
Functions to encode UUIDs using a shortened encoding that can be used
with Bhyve's virtual machine name limitations. Essentially, Bhyve limits
names to at most 31 characters on modern FreeBSD versions.
-
Field Summary
Fields Modifier and Type Field Description static java.util.regex.PatternSHORT_ID_PATTERNThe pattern that defines a valid short ID. -
Method Summary
-
Field Details
-
SHORT_ID_PATTERN
public static final java.util.regex.Pattern SHORT_ID_PATTERNThe pattern that defines a valid short ID.
-
-
Method Details
-
encode
public static java.lang.String encode(java.util.UUID uuid)Produce a shortened encoding of the given UUID.- Parameters:
uuid- The uuid- Returns:
- An encoded UUID
-
decode
public static java.util.UUID decode(java.lang.String shortId)Decode a shortened ID to a UUID.- Parameters:
shortId- The short ID- Returns:
- A UUID
-