Package net.sf.basedb.util.formatter
Class IdentifiableFormatter
java.lang.Object
net.sf.basedb.util.formatter.IdentifiableFormatter
- All Implemented Interfaces:
Formatter<Identifiable>
Formatter to handle
Identifiable
items. The formatter
returns the ID of the item. This formatter can not parse strings.- Version:
- 2.12
- Author:
- Nicklas
- Last modified
- $Date: 2009-05-08 13:30:36 +0200 (fr, 08 maj 2009) $
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreate a new formatter.IdentifiableFormatter
(String nullValue) Create a new formatter. -
Method Summary
Modifier and TypeMethodDescriptionformat
(Identifiable value) Format a value by converting it to a string.parseString
(String value) Parse a string and return a value of the correct type.
-
Field Details
-
nullValue
-
-
Constructor Details
-
IdentifiableFormatter
public IdentifiableFormatter()Create a new formatter. Null values are formatted as an empty string. -
IdentifiableFormatter
Create a new formatter.- Parameters:
nullValue
- The string to return if a null item is passed toformat(Identifiable)
-
-
Method Details
-
format
Description copied from interface:Formatter
Format a value by converting it to a string.- Specified by:
format
in interfaceFormatter<Identifiable>
- Parameters:
value
- The value to format- Returns:
- A formatted string
-
parseString
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<Identifiable>
- Parameters:
value
- The string to parse- Returns:
- An object
- Throws:
UnsupportedOperationException
- Always
-