3.0.4: 2012-03-05

net.sf.basedb.util.formatter
Class ItemTypeFormatter

java.lang.Object
  extended by net.sf.basedb.util.formatter.ItemTypeFormatter
All Implemented Interfaces:
Formatter<Integer>

public class ItemTypeFormatter
extends Object
implements Formatter<Integer>

Formatter implementation that converts an integer into it's Item representation and the uses name() as the formatted value.

Since:
3.0
Author:
Nicklas
Last modified
$Date: 2011-06-23 11:53:05 +0200 (Thu, 23 Jun 2011) $

Field Summary
private  String nullValue
           
 
Constructor Summary
ItemTypeFormatter()
          Create a new formatter.
ItemTypeFormatter(String nullValue)
          Create a new formatter.
 
Method Summary
 String format(Integer value)
          Format a value by converting it to a string.
 Integer parseString(String value)
          Parse a string and return a value of the correct type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nullValue

private String nullValue
Constructor Detail

ItemTypeFormatter

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


ItemTypeFormatter

public ItemTypeFormatter(String nullValue)
Create a new formatter.

Parameters:
nullValue - The string to return if a null item is passed to format(Integer)
Method Detail

format

public String format(Integer value)
Description copied from interface: Formatter
Format a value by converting it to a string.

Specified by:
format in interface Formatter<Integer>
Parameters:
value - The value to format
Returns:
A formatted string

parseString

public Integer 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<Integer>
Parameters:
value - The string to parse
Returns:
An object

3.0.4: 2012-03-05