public interface AsciiConverterConfig
Interface for the configuration of
AsciiConverter
usage. Abstraction via interface allows to change
implementation as record, bean, enum, or whatever without breaking compatibility. Example usage:
AsciiConverterConfig
config =AsciiConverterConfig
.of()
.withCaseConversion
(CaseConversion.LOWER_CASE
).withUnmappedCodePoint
("[?]").withIncludeControlCharacters
(true);
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
static AsciiConverterConfig
of()
boolean
withCaseConversion
(CaseConversion conversion) withIncludeControlChars
(boolean include) withNormalizeNumbers
(boolean normalize) withUnmappedCodePoint
(String ascii) withUseLongForms
(boolean longForms)
-
Method Details
-
caseConversion
CaseConversion caseConversion()- Returns:
- the
configured
CaseConversion
.
-
withCaseConversion
- Parameters:
conversion
- theCaseConversion
to use. Allows you to get the result in UPPER or lower-case what is faster than converting the result to that after ASCII conversion.- Returns:
- this
AsciiConverterConfig
for fluent API calls.
-
unmappedCodePoint
String unmappedCodePoint()- Returns:
- the
configured undefined code-point
.
-
withUnmappedCodePoint
- Parameters:
ascii
- theString
to use for unmappedcode-points
. The default is the emptyString
to ignore them. You may use something like "?" or "[?]" instead to make them visible. ThisString
should consist only of 7-bit ASCII characters or your converted result may not be ASCII.- Returns:
- this
AsciiConverterConfig
for fluent API calls.
-
includeControlChars
boolean includeControlChars()- Returns:
- the
configured include-control-characters flag
.
-
withIncludeControlChars
- Parameters:
include
- - the ASCII control characters 0x00-0x1F except 0x09 and 0x0A are typically stripped out. This happens if this flag isfalse
. However, providetrue
to include these control characters into the result.- Returns:
- this
AsciiConverterConfig
for fluent API calls.
-
normalizeNumbers
boolean normalizeNumbers()- Returns:
- the
configured normalize-numbers flag
.
-
withNormalizeNumbers
- Parameters:
normalize
- - usually foreign number symbols are added as text, what happens if this flag isfalse
. If you providetrue
here, sequential number symbols may be added and the result converted to Arabic numbers with ASCII digits. E.g. "ⅩⅭ" ("XC") will result in "90".- Returns:
- this
AsciiConverterConfig
for fluent API calls.
-
useLongForms
boolean useLongForms()- Returns:
- the
configured use-long-forms flag
.
-
withUseLongForms
- Parameters:
longForms
- - usually a compact ASCII form is preferred, what happens if this flag isfalse
. If you providetrue
here, long forms will be preferred for currencies, numbers, and units.- Returns:
- this
AsciiConverterConfig
for fluent API calls.
-
of
- Returns:
- a default instance of
AsciiConverterConfig
.
-