Package io.permazen.encoding
Class EncodingIds
java.lang.Object
io.permazen.encoding.EncodingIds
EncodingId
's for Permazen built-in encodings.- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.static EncodingId
Build an encoding ID for a built-in Permazen encoding, using the given suffix.static EncodingId
idForAlias
(String alias) Get the encoding ID corresponding to the given alias (or "nickname"), if any, for a Permazen built-in encoding.static boolean
isValidBuiltinSuffix
(String suffix) Determine if the given string is a valid Permazen built-in encoding ID suffix.
-
Field Details
-
PERMAZEN_PREFIX
Prefix for Permazen built-in encodings.- See Also:
-
-
Method Details
-
builtin
Build an encoding ID for a built-in Permazen encoding, using the given suffix.- Parameters:
suffix
- ID suffix- Throws:
IllegalArgumentException
- ifsuffix
is null or invalid
-
isValidBuiltinSuffix
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
- ifsuffix
is null
-
idForAlias
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()
: Ifalias
satisfiesisValidBuiltinSuffix()
, then this method delegates tobuiltin()
, otherwise tonew EncodingId()
.- Parameters:
alias
- encoding ID alias- Returns:
- corresponding encoding ID, never null
- Throws:
IllegalArgumentException
- ifalias
is null or not a valid alias
-
aliasForId
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()
: IfencodingId
equals "urn:fdc:permazen.io:2020:" followed by a suffix satisfyingisValidBuiltinSuffix()
, then the suffix is returned, otherwiseencodingId
in string form is returned.- Parameters:
encodingId
- encoding ID- Returns:
- corresponding alias, if any, otherwise
EncodingId.getId()
- Throws:
IllegalArgumentException
- ifencodingId
is null
-