Class EncodingIds

java.lang.Object
io.permazen.encoding.EncodingIds

public final class EncodingIds extends Object
EncodingId's for Permazen built-in encodings.
See Also:
  • Field Details

  • Method Details

    • builtin

      public static EncodingId builtin(String suffix)
      Build an encoding ID for a built-in Permazen encoding, using the given suffix.
      Parameters:
      suffix - ID suffix
      Throws:
      IllegalArgumentException - if suffix is null or invalid
    • isValidBuiltinSuffix

      public static boolean isValidBuiltinSuffix(String suffix)
      Determine if the given string is a valid Permazen built-in encoding ID suffix.

      Valid suffixes must start with an ASCII letter; contain only ASCII letters, digits, underscores, and dashes; not end with a dash; and not have any consecutive dashes. They may have up to 255 trailing [] array dimensions.

      Parameters:
      suffix - ID suffix
      Returns:
      true if suffix is a valid suffix, false otherwise
      Throws:
      IllegalArgumentException - if suffix is null
    • idForAlias

      public static EncodingId idForAlias(String alias)
      Get the encoding ID corresponding to the given alias (or "nickname"), if any, for a Permazen built-in encoding.

      This implements the default logic for DefaultEncodingRegistry.idForAlias(): If alias satisfies isValidBuiltinSuffix(), then this method delegates to builtin(), otherwise to new EncodingId().

      Parameters:
      alias - encoding ID alias
      Returns:
      corresponding encoding ID, never null
      Throws:
      IllegalArgumentException - if alias is null or not a valid alias
    • aliasForId

      public static String aliasForId(EncodingId encodingId)
      Get the alias (or "nickname") for the given encoding ID in this registry, if any, for a Permazen built-in encoding.

      This implements the default logic for DefaultEncodingRegistry.aliasForId(): If encodingId equals "urn:fdc:permazen.io:2020:" followed by a suffix satisfying isValidBuiltinSuffix(), then the suffix is returned, otherwise encodingId in string form is returned.

      Parameters:
      encodingId - encoding ID
      Returns:
      corresponding alias, if any, otherwise EncodingId.getId()
      Throws:
      IllegalArgumentException - if encodingId is null