java.lang.Object
com.pervasive.datarush.encoding.text.StringFormatter
- All Implemented Interfaces:
TokenFormatter
Converts a string token value to a string.
Depending on configuration, leading and trailing
whitespace is stripped.
-
Constructor Summary
ConstructorsConstructorDescriptionStringFormatter(boolean trimWhitespace) Creates a new formatter with the specified behavior with respect whitespace.StringFormatter(boolean trimWhitespace, String nullIndicator) Creates a formatter using the specified whitespace behavior and null indicator. -
Method Summary
Modifier and TypeMethodDescriptionfinal Stringformat()Formats the current value of the source as a text value.final voidsetSource(ScalarValued source) Sets the container holding values to be formatted.
-
Constructor Details
-
StringFormatter
public StringFormatter(boolean trimWhitespace) Creates a new formatter with the specified behavior with respect whitespace.- Parameters:
trimWhitespace- indicates whether leading and trailing whitespace should be removed
-
StringFormatter
Creates a formatter using the specified whitespace behavior and null indicator. Null values are output as the specified string.- Parameters:
trimWhitespace- indicates whether leading and trailing whitespace should be removednullIndicator- the text value to use for null values
-
-
Method Details
-
setSource
Description copied from interface:TokenFormatterSets the container holding values to be formatted. A reference to this container is held and accessed only when an formatting is requested.- Specified by:
setSourcein interfaceTokenFormatter- Parameters:
source- the value container to format
-
format
Description copied from interface:TokenFormatterFormats the current value of the source as a text value.- Specified by:
formatin interfaceTokenFormatter- Returns:
- the value of the source as a string
-