Class NameableFormatter

  • All Implemented Interfaces:
    Formatter<Nameable>

    public class NameableFormatter
    extends Object
    implements Formatter<Nameable>
    Formatter to handle Nameable items.
    Version:
    2.12
    Author:
    martin
    Last modified
    $Date: 2009-05-08 13:30:36 +0200 (fr, 08 maj 2009) $
    • Field Detail

      • nullValue

        private String nullValue
    • Constructor Detail

      • NameableFormatter

        public NameableFormatter()
        Create a new formatter. Null values are formatted as an empty string.
      • NameableFormatter

        public NameableFormatter​(String nullValue)
        Create a new formatter.
        Parameters:
        nullValue - The string to return if a null item is passed to format(Nameable)
    • Method Detail

      • format

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

        public Nameable 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<Nameable>
        Parameters:
        value - The string to parse
        Returns:
        An object
        Throws:
        UnsupportedOperationException - Always