All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----org.xmlmiddleware.conversions.formatters.BooleanFormatter
The accepted string forms of true are:
TRUE YES 1
The accepted string forms of false are:
FALSE NO 0
All are case insensitive.
This class can easily be sub-classed to recognize other words as true and false. To do this, simply override the value of the trueValues and falseValues arrays and provide the string values to be recognized as true and false. The first value in each array is used as the output of the format method, and the caseSensitive variable states whether values are case sensitive or not.
For example, the following code creates a case-sensitive German version of Boolean formatter:
public class GermanBooleanFormatter extends BooleanFormatter implements StringFormatter { public GermanBooleanFormatter() {super();} public String[] trueValues = {"wahr", "ja"}; public String[] falseValues = {"falsch", "nein"}; public boolean caseSensitive = true; }
public String trueValues[]
The first string is used as the output value of format().
public String falseValues[]
The first string is used as the output value of format().
public boolean caseSensitive
public BooleanFormatter()
public Object parse(String s, int jdbcType) throws XMLMiddlewareException
public String format(Object o) throws XMLMiddlewareException
public boolean canConvert(int type)
This method returns true for Types.BIT. It returns false for all other types.
All Packages Class Hierarchy This Package Previous Next Index