Class StringFormatter

java.lang.Object
net.sf.basedb.clients.web.formatter.StringFormatter
All Implemented Interfaces:
ExcelFormatter<String,String>, Formatter<String>

public class StringFormatter extends Object implements Formatter<String>, ExcelFormatter<String,String>
Format a string for output on a web page. This means that the string is encoded by the HTML.encodeTags(String) method to prevent pollution of the generated HTML.
Version:
2.0
Author:
nicklas
Last modified
$Date: 2019-03-13 15:33:25 +0100 (ons, 13 mars 2019) $
  • Constructor Details

    • StringFormatter

      public StringFormatter()
      Create a new string formatter.
  • Method Details

    • format

      public String format(String value)
      Description copied from interface: Formatter
      Format a value by converting it to a string.
      Specified by:
      format in interface Formatter<String>
      Parameters:
      value - The value to format
      Returns:
      A formatted string
    • parseString

      public String parseString(String value)
      Description copied from interface: Formatter
      Parse a string and return a value of the correct type. A null input string should (unless otherwise documented by a specific formatter implementation) be allowed and may return null or any other "default" value.
      Specified by:
      parseString in interface Formatter<String>
      Parameters:
      value - The string to parse
      Returns:
      An object
    • toExcelValue

      public ExcelValue<String> toExcelValue(String value)
      No escaping is needed.
      Specified by:
      toExcelValue in interface ExcelFormatter<String,String>
      Since:
      3.15