2.17.2: 2011-06-17

net.sf.basedb.util.formatter
Class BooleanFormatter

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

public class BooleanFormatter
extends Object
implements Formatter<Boolean>

Formats a boolean value. It is possible to select between yes/no, true/false, and 1/0 mappings.

Version:
2.0
Author:
nicklas
Last modified
$Date: 2008-09-11 22:08:14 +0200 (Thu, 11 Sep 2008) $

Nested Class Summary
static class BooleanFormatter.Type
          Enum for holding the various types of boolean output.
 
Field Summary
private  BooleanFormatter.Type type
           
 
Constructor Summary
BooleanFormatter(BooleanFormatter.Type type)
          Create a new boolean formatter.
 
Method Summary
 String format(Boolean value)
          Format a value by converting it to a string.
 Boolean 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

type

private final BooleanFormatter.Type type
Constructor Detail

BooleanFormatter

public BooleanFormatter(BooleanFormatter.Type type)
Create a new boolean formatter.

Parameters:
type - The type of output
Method Detail

format

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

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

parseString

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

2.17.2: 2011-06-17