Class EncodingId

java.lang.Object
io.permazen.encoding.EncodingId
All Implemented Interfaces:
Serializable, Comparable<EncodingId>

public class EncodingId extends Object implements Comparable<EncodingId>, Serializable
A globally unique identifier for a simple field encoding scheme.

Encoding ID's are Uniform Resource Names (URNs), with these differences:

  • The first two fields (the "urn" and the NID) must be lowercase.
  • The optional r-components, q-components, and f-components are disallowed.
  • The URN proper may be followed by up to 255 trailing [] pairs, indicating an array type.

Valid encoding ID's must match PATTERN, which encodes the above rules.

See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getId

      public String getId()
      Get the encoding ID.
      Returns:
      encoding ID
    • getBaseId

      public String getBaseId()
      Get the base encoding ID.

      If this ID does not specify an array encoding, this is just the ID itself. Otherwise, this method returns the ID without any trailing [] pairs.

      Returns:
      this encoding ID without any array dimensions
    • getArrayDimensions

      public int getArrayDimensions()
      Get the number of array dimensions.
      Returns:
      number of array dimensions, from zero to 255
    • getElementId

      public EncodingId getElementId()
      Get the encoding ID corresponding to one fewer array dimension.
      Returns:
      element encoding ID
      Throws:
      IllegalArgumentException - if this instance has zero array dimensions
    • getArrayId

      public EncodingId getArrayId()
      Get the encoding ID corresponding to one more array dimension.
      Returns:
      element encoding ID
      Throws:
      IllegalArgumentException - if this instance already has the maximum number of array dimensions
    • compareTo

      public int compareTo(EncodingId that)
      Specified by:
      compareTo in interface Comparable<EncodingId>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object