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:
AsciiConverterConfigconfig =AsciiConverterConfig.of().withCaseConversion(CaseConversion.LOWER_CASE).withUnmappedCodePoint("[?]").withIncludeControlCharacters(true);
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanstatic AsciiConverterConfigof()booleanwithCaseConversion(CaseConversion conversion) withIncludeControlChars(boolean include) withNormalizeNumbers(boolean normalize) withUnmappedCodePoint(String ascii) withUseLongForms(boolean longForms)
-
Method Details
-
caseConversion
CaseConversion caseConversion()- Returns:
- the
configuredCaseConversion.
-
withCaseConversion
- Parameters:
conversion- theCaseConversionto 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
AsciiConverterConfigfor fluent API calls.
-
unmappedCodePoint
String unmappedCodePoint()- Returns:
- the
configured undefined code-point.
-
withUnmappedCodePoint
- Parameters:
ascii- theStringto use for unmappedcode-points. The default is the emptyStringto ignore them. You may use something like "?" or "[?]" instead to make them visible. ThisStringshould consist only of 7-bit ASCII characters or your converted result may not be ASCII.- Returns:
- this
AsciiConverterConfigfor 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, providetrueto include these control characters into the result.- Returns:
- this
AsciiConverterConfigfor 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 providetruehere, 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
AsciiConverterConfigfor 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 providetruehere, long forms will be preferred for currencies, numbers, and units.- Returns:
- this
AsciiConverterConfigfor fluent API calls.
-
of
- Returns:
- a default instance of
AsciiConverterConfig.
-