Class GenericObjectFormatter

  • All Implemented Interfaces:
    TokenFormatter

    public class GenericObjectFormatter
    extends Object
    A formatter representing object token values as text values. Objects are mapped to their default toString output.
    • Constructor Detail

      • GenericObjectFormatter

        public GenericObjectFormatter​(ObjectTokenType<?> type)
        Creates a ormatter using the specified object type. Null values are output as the empty string.
        Parameters:
        type - the object for which the formatter is defined
      • GenericObjectFormatter

        public GenericObjectFormatter​(ObjectTokenType<?> type,
                                      String nullIndicator)
        Creates a formatter using the specified object type.
        Parameters:
        type - the object for which the formatter is defined
        nullIndicator - the text value to use fo 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