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.Pattern SHORT_ID_PATTERN
    The pattern that defines a valid short ID.
  • Method Summary

    Modifier and Type Method Description
    static java.util.UUID decode​(java.lang.String shortId)
    Decode a shortened ID to a UUID.
    static java.lang.String encode​(java.util.UUID uuid)
    Produce a shortened encoding of the given UUID.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SHORT_ID_PATTERN

      public static final java.util.regex.Pattern SHORT_ID_PATTERN
      The 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