Class NcnameCodec

  • All Implemented Interfaces:
    UuidCodec<String>

    public final class NcnameCodec
    extends Object
    implements UuidCodec<String>
    Codec for UUID NCNames.

    A UUID NCName is a shorter string representation that conforms to the constraints of various other identifiers such as NCName in XML documents.

    The NcnameCodec turns a UUID into a string that does not start with digits (0-9). But due to the default base-64-url encoding, it is case sensitive and may contain '-' and '_'.

    The Base32Codec can be passed to the NcnameCodec constructor to generate base-32 NCNames. Due to the base-32 alphabet, it is case insensitive and it contains only letters (a-zA-Z) and digits (2-7). This encoding substitution can be done to avoid the characters '-' and '_' of the base-64-url encoding, but it makes the NCName case insensitive.

    The transformation scheme is outlined in this RFC: https://tools.ietf.org/html/draft-taylor-uuid-ncname-00. The draft describes schemes for base-64-url and base-32.

    SlugCodec and NcnameCodec are very similar. The difference between the two is the bit shift they do with the original UUID to transform it into a string.

    See Also:
    UUID NCNames
    • Field Detail

      • INSTANCE

        public static final NcnameCodec INSTANCE
        A shared immutable instance using `base64url`
    • Constructor Detail

      • NcnameCodec

        public NcnameCodec()
      • NcnameCodec

        public NcnameCodec​(BaseNCodec codec)