Package org.beanio.types.xml
Class XmlBooleanTypeHandler
- java.lang.Object
-
- org.beanio.types.xml.XmlBooleanTypeHandler
-
- All Implemented Interfaces:
TypeHandler
public class XmlBooleanTypeHandler extends java.lang.Object implements TypeHandler
A type handler implementation for theBoolean
class based on the W3C XML Schema boolean datatype specification.- Since:
- 1.1
-
-
Field Summary
-
Fields inherited from interface org.beanio.types.TypeHandler
NIL
-
-
Constructor Summary
Constructors Constructor Description XmlBooleanTypeHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
format(java.lang.Object value)
ReturnsBoolean.toString()
, ornull
ifvalue
isnull
.java.lang.Class<?>
getType()
Returns the class type supported by this handler.boolean
isNumericFormatEnabled()
Returns whether the numeric format of a XML boolean is used to format JavaBoolean
types.java.lang.Boolean
parse(java.lang.String text)
Parses a Boolean object from the given text.void
setNumericFormatEnabled(boolean numericFormatEnabled)
Sets whether the numeric format of a XML boolean is used to format JavaBoolean
types.
-
-
-
Method Detail
-
parse
public java.lang.Boolean parse(java.lang.String text) throws TypeConversionException
Parses a Boolean object from the given text.- Specified by:
parse
in interfaceTypeHandler
- Parameters:
text
- the text to parse- Returns:
- new Boolean
- Throws:
TypeConversionException
- if the text cannot be parsed
-
format
public java.lang.String format(java.lang.Object value)
ReturnsBoolean.toString()
, ornull
ifvalue
isnull
.- Specified by:
format
in interfaceTypeHandler
- Parameters:
value
- the Java object to format, which may be null- Returns:
- the formatted field text, or
null
to indicate the value is not present, orTypeHandler.NIL
for XML formatted streams
-
getType
public java.lang.Class<?> getType()
Description copied from interface:TypeHandler
Returns the class type supported by this handler. Primitive types should not be returned by this method- use the object equivalent instead.- Specified by:
getType
in interfaceTypeHandler
- Returns:
- the class type supported by this handler
-
isNumericFormatEnabled
public boolean isNumericFormatEnabled()
Returns whether the numeric format of a XML boolean is used to format JavaBoolean
types.- Returns:
true
if a Boolean is formatted using 0 and 1 instead of 'true' and 'false'
-
setNumericFormatEnabled
public void setNumericFormatEnabled(boolean numericFormatEnabled)
Sets whether the numeric format of a XML boolean is used to format JavaBoolean
types.- Parameters:
numericFormatEnabled
-true
if a Boolean is formatted using 0 and 1 instead of 'true' and 'false'
-
-