Package net.sf.basedb.util.formatter
Class NameableFormatter
- java.lang.Object
-
- net.sf.basedb.util.formatter.NameableFormatter
-
-
Constructor Summary
Constructors Constructor Description NameableFormatter()
Create a new formatter.NameableFormatter(String nullValue)
Create a new formatter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(Nameable nameableItem)
Format a value by converting it to a string.Nameable
parseString(String value)
Parse a string and return a value of the correct type.
-
-
-
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 toformat(Nameable)
-
-
Method Detail
-
format
public String format(Nameable nameableItem)
Description copied from interface:Formatter
Format a value by converting it to a 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 interfaceFormatter<Nameable>
- Parameters:
value
- The string to parse- Returns:
- An object
- Throws:
UnsupportedOperationException
- Always
-
-