/** You may copy this example and use it for any purpose, commercial or otherwise. */ import com.ricebridge.data.sc.DefaultStringConverter; import java.text.DateFormat; import java.util.Date; /** This utility class shows how to implement a StringConverter for * custom conversion of textual data into Java data types. It converts * 'yes' and 'no' into true and false; * * To compile this class, you will need to include csvman.jar * (in the lib folder of the CSV Manager distribution) in your CLASSPATH. */ public class YesNoConverter extends DefaultStringConverter { /** Create a Boolean from a String. */ protected Object makeObjectImpl( String pValue ) throws Exception { return new Boolean( "yes".equalsIgnoreCase( pValue ) ); } /** Return the default yes/no object. */ protected Object makeDefaultObjectImpl() { return new Boolean(false); } /** Create a String from a Boolean object. */ protected String makeStringImpl( Object pValue ) throws Exception { return ((Boolean)pValue).booleanValue()?"yes":"no"; } /** Return the default String. */ protected String makeDefaultStringImpl() { return "no"; } }