org.formproc.conversion
Class BooleanConverter

java.lang.Object
  |
  +--org.formproc.conversion.AbstractTypeConverter
        |
        +--org.formproc.conversion.BooleanConverter
All Implemented Interfaces:
TypeConverter

public class BooleanConverter
extends AbstractTypeConverter

TypeConverter which converts to an Boolean. The data objects toString() method will be used to convert the data object to a String first.

This class includes a property allow-extended which if set to true will allow additional values to be considered true. Values which will convert to true are:

  • true
  • yes
  • any positive integer

    The default value for this property is 'false'.

    Author:
    Anthony Eden

    Constructor Summary
    BooleanConverter()
               
     
    Method Summary
     java.lang.Object convert(java.lang.Object data, java.util.Locale locale)
              Convert the given data object to an Boolean.
     boolean isAllowExtended()
              Get the allow extended property value.
     void loadConfiguration(com.anthonyeden.lib.config.Configuration configuration)
              Load the converter's configuration.
     void setAllowExtended(boolean allowExtended)
              Set the allow extended property.
     void setAllowExtended(java.lang.String allowExtended)
              Set the allow extended property.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    BooleanConverter

    public BooleanConverter()
    Method Detail

    convert

    public java.lang.Object convert(java.lang.Object data,
                                    java.util.Locale locale)
                             throws java.lang.Exception
    Convert the given data object to an Boolean.

    Parameters:
    data - The data
    locale - The locale
    Returns:
    The resulting object
    Throws:
    java.lang.Exception

    loadConfiguration

    public void loadConfiguration(com.anthonyeden.lib.config.Configuration configuration)
                           throws com.anthonyeden.lib.config.ConfigurationException
    Load the converter's configuration.

    Specified by:
    loadConfiguration in interface TypeConverter
    Overrides:
    loadConfiguration in class AbstractTypeConverter
    Parameters:
    configuration - The configuration object
    Throws:
    com.anthonyeden.lib.config.ConfigurationException

    isAllowExtended

    public boolean isAllowExtended()
    Get the allow extended property value.

    Returns:
    True if allow extended

    setAllowExtended

    public void setAllowExtended(boolean allowExtended)
    Set the allow extended property.

    Parameters:
    allowExtended - Set to true to allow for extended true values

    setAllowExtended

    public void setAllowExtended(java.lang.String allowExtended)
    Set the allow extended property.

    Parameters:
    allowExtended - Set to true to allow for extended true values


    Copyright (c) 2001-2003 Anthony Eden. All Rights Reserved.