Package org.xbill.DNS
Class Mnemonic
java.lang.Object
org.xbill.DNS.Mnemonic
- Direct Known Subclasses:
DClass.DClassMnemonic,SVCBBase.ParameterMnemonic,Type.TypeMnemonic
A utility class for converting between numeric codes and mnemonics for those codes. Mnemonics are
case insensitive.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDefines the text representation of a numeric value.voidDefines an additional text representation of a numeric value.voidCopies all mnemonics from one table into another.voidcheck(int val) Checks that a numeric value is within the range [0..max]getText(int val) Gets the text mnemonic corresponding to a numeric value.intGets the numeric value corresponding to a text mnemonic.private intvoidremove(int val) Removes both the numeric value and its text representation, including all aliases.voidremoveAlias(String str) Removes an additional text representation of a numeric value.private StringvoidsetMaximum(int max) Sets the maximum numeric valuevoidsetNumericAllowed(boolean numeric) Sets whether numeric values stored in strings are acceptable.voidSets the prefix to use when converting to and from values that don't have mnemonics.
-
Field Details
-
CASE_SENSITIVE
static final int CASE_SENSITIVE- See Also:
-
CASE_UPPER
static final int CASE_UPPER- See Also:
-
CASE_LOWER
static final int CASE_LOWER- See Also:
-
strings
-
values
-
description
-
wordcase
private final int wordcase -
prefix
-
max
private int max -
numericok
private boolean numericok
-
-
Constructor Details
-
Mnemonic
Creates a new Mnemonic table.- Parameters:
description- A short description of the mnemonic to use whenwordcase- Whether to convert strings into uppercase, lowercase, or leave them unchanged. throwing exceptions.
-
-
Method Details
-
setMaximum
public void setMaximum(int max) Sets the maximum numeric value -
setPrefix
Sets the prefix to use when converting to and from values that don't have mnemonics. -
setNumericAllowed
public void setNumericAllowed(boolean numeric) Sets whether numeric values stored in strings are acceptable. -
check
public void check(int val) Checks that a numeric value is within the range [0..max] -
sanitize
-
parseNumeric
-
add
Defines the text representation of a numeric value.- Parameters:
val- The numeric valuestr- The text string
-
remove
public void remove(int val) Removes both the numeric value and its text representation, including all aliases.- Parameters:
val- The numeric value- Since:
- 3.1
-
addAlias
Defines an additional text representation of a numeric value. This will be used by getValue(), but not getText().- Parameters:
val- The numeric valuestr- The text string
-
removeAlias
Removes an additional text representation of a numeric value.- Parameters:
str- The text string- Since:
- 3.1
-
addAll
Copies all mnemonics from one table into another.- Parameters:
source- The source mnemonic- Throws:
IllegalArgumentException- The wordcases of the Mnemonics do not match.
-
getText
Gets the text mnemonic corresponding to a numeric value.- Parameters:
val- The numeric value- Returns:
- The corresponding text mnemonic.
-
getValue
Gets the numeric value corresponding to a text mnemonic.- Parameters:
str- The text mnemonic- Returns:
- The corresponding numeric value, or -1 if there is none
-