BeanIO 1.2.3

org.beanio.types
Class BooleanTypeHandler

java.lang.Object
  extended by org.beanio.types.BooleanTypeHandler
All Implemented Interfaces:
TypeHandler

public class BooleanTypeHandler
extends Object
implements TypeHandler

A type handler implementation for the Boolean class, that simply delegate parsing to its constructor.

Since:
1.0
Author:
Kevin Seim

Field Summary
 
Fields inherited from interface org.beanio.types.TypeHandler
NIL
 
Constructor Summary
BooleanTypeHandler()
           
 
Method Summary
 String format(Object value)
          Returns Boolean.toString(), or null if value is null.
 Class<?> getType()
          Returns the class type supported by this handler.
 Boolean parse(String text)
          Parses a Boolean object from the given text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BooleanTypeHandler

public BooleanTypeHandler()
Method Detail

parse

public Boolean parse(String text)
              throws TypeConversionException
Parses a Boolean object from the given text.

Specified by:
parse in interface TypeHandler
Parameters:
text - the text to parse
Returns:
new Boolean
Throws:
TypeConversionException - if the text cannot be parsed

format

public String format(Object value)
Returns Boolean.toString(), or null if value is null.

Specified by:
format in interface TypeHandler
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, or TypeHandler.NIL for XML formatted streams

getType

public 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 interface TypeHandler
Returns:
the class type supported by this handler

BeanIO 1.2.3

Copyright © 2010-2012 Kevin Seim