Interface Stringifier

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Stringifier
A stringifier is responsible for stringifying the values that are inserted into a template. There is no limitation on the types of values that can be inserted into a template, but they must ultimately be interwoven with the boilerplate text of the template, which requires them to become strings. By default, all values except null are stringified by calling toString() on them; null is stringified to an empty string. However, this can be customized in multiple ways using a StringifierRegistry. Note that escaping (e.g. HTML) and formatting (e.g. dates) are also considered to be forms of stringification.
Author:
Ayco Holleman
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Stringifier
    A stringifier that stringifies null to an empty string and any other value by calling toString() on it.
  • Method Summary

    Modifier and Type
    Method
    Description
    Stringifies the specified value.
  • Field Details

  • Method Details

    • stringify

      String stringify(Object value)
      Stringifies the specified value. Stringifier implementations must be able to handle null values and they must never return null. A RenderException is thrown if either requirement is not met.
      Parameters:
      value - the value to be stringified
      Returns:
      a string representation of the value