Package io.permazen.encoding
Class EncodingId
java.lang.Object
io.permazen.encoding.EncodingId
- All Implemented Interfaces:
Serializable
,Comparable<EncodingId>
A globally unique identifier that identifies an
Encoding
's encoding scheme.
Encoding ID's are Uniform Resource Names (URNs), with these differences:
- The first two fields (the
"urn"
and theNID
) 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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(EncodingId that) boolean
int
Get the number of array dimensions.Get the encoding ID corresponding to one more array dimension.Get the base encoding ID.Get the encoding ID corresponding to one fewer array dimension.getId()
Get the encoding ID.int
hashCode()
toString()
-
Field Details
-
ARRAY_SUFFIX
Encoding ID array suffix.- See Also:
-
PATTERN
The regular expression that encoding ID's must match.- See Also:
-
-
Constructor Details
-
EncodingId
Constructor.- Parameters:
id
- the encoding ID- Throws:
IllegalArgumentException
- ifid
is null or invalid
-
-
Method Details
-
getId
Get the encoding ID.- Returns:
- encoding ID
-
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
Get the encoding ID corresponding to one fewer array dimension.- Returns:
- element encoding ID
- Throws:
IllegalArgumentException
- if this instance has zero array dimensions
-
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
- Specified by:
compareTo
in interfaceComparable<EncodingId>
-
toString
-
hashCode
public int hashCode() -
equals
-