Class StringFormatter

  • All Implemented Interfaces:
    TokenFormatter

    public class StringFormatter
    extends Object
    Converts a string token value to a string. Depending on configuration, leading and trailing whitespace is stripped.
    • Constructor Detail

      • 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

        public StringFormatter​(boolean trimWhitespace,
                               String nullIndicator)
        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 removed
        nullIndicator - the text value to use for null values
    • Method Detail

      • setSource

        public final void setSource​(ScalarValued source)
        Description copied from interface: TokenFormatter
        Sets the container holding values to be formatted. A reference to this container is held and accessed only when an formatting is requested.
        Specified by:
        setSource in interface TokenFormatter
        Parameters:
        source - the value container to format
      • format

        public final String format()
        Description copied from interface: TokenFormatter
        Formats the current value of the source as a text value.
        Specified by:
        format in interface TokenFormatter
        Returns:
        the value of the source as a string