org.springframework.binding.convert.support
Class TextToBoolean

java.lang.Object
  extended by org.springframework.binding.convert.support.AbstractConverter
      extended by org.springframework.binding.convert.support.TextToBoolean
All Implemented Interfaces:
Converter

public class TextToBoolean
extends AbstractConverter

Converts a textual representation of a boolean object to a Boolean instance.

Author:
Keith Donald

Constructor Summary
TextToBoolean()
          Default constructor.
TextToBoolean(java.lang.String trueString, java.lang.String falseString)
          Create a text to boolean converter.
 
Method Summary
protected  java.lang.Object doConvert(java.lang.Object source, java.lang.Class targetClass, ConversionContext context)
          Template method subclasses should override to actually perform the type conversion.
 java.lang.Class[] getSourceClasses()
          The source classes this converter can convert from.
 java.lang.Class[] getTargetClasses()
          The target classes this converter can convert to.
 
Methods inherited from class org.springframework.binding.convert.support.AbstractConverter
convert, convert, convert, convert
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextToBoolean

public TextToBoolean()
Default constructor. No special true or false strings are considered.


TextToBoolean

public TextToBoolean(java.lang.String trueString,
                     java.lang.String falseString)
Create a text to boolean converter. Take given special string representations of true and false into account.

Parameters:
trueString - special true string to consider
falseString - special false string to consider
Method Detail

getSourceClasses

public java.lang.Class[] getSourceClasses()
Description copied from interface: Converter
The source classes this converter can convert from.

Returns:
the supported source classes

getTargetClasses

public java.lang.Class[] getTargetClasses()
Description copied from interface: Converter
The target classes this converter can convert to.

Returns:
the supported target classes

doConvert

protected java.lang.Object doConvert(java.lang.Object source,
                                     java.lang.Class targetClass,
                                     ConversionContext context)
                              throws java.lang.Exception
Description copied from class: AbstractConverter
Template method subclasses should override to actually perform the type conversion.

Specified by:
doConvert in class AbstractConverter
Parameters:
source - the source to convert from
targetClass - the target type to convert to
context - an optional conversion context that may be used to influence the conversion process, could be null
Returns:
the converted source value
Throws:
java.lang.Exception - an exception occured, will be wrapped in a conversion exception if necessary


Copyright � 2004-2007. All Rights Reserved.