KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > soto > config > types > BooleanType


1 package org.sapia.soto.config.types;
2
3 import org.sapia.util.xml.confix.ConfigurationException;
4 import org.sapia.util.xml.confix.ObjectCreationCallback;
5
6 /**
7  * @author Yanick Duchesne
8  *
9  * <dl>
10  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2004 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
11  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
12  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
13  * </dl>
14  */

15 public class BooleanType implements ObjectCreationCallback{
16     
17     private final String JavaDoc ON = "on";
18     private final String JavaDoc TRUE = "true";
19     private final String JavaDoc YES = "yes";
20     
21     private boolean _value;
22     
23     public void setValue(String JavaDoc value){
24         _value = value.equalsIgnoreCase(ON) || value.equalsIgnoreCase(TRUE) || value.equalsIgnoreCase(YES);
25     }
26     
27     /**
28    * @see org.sapia.util.xml.confix.ObjectCreationCallback#onCreate()
29    */

30   public Object JavaDoc onCreate() throws ConfigurationException {
31     return new Boolean JavaDoc(_value);
32   }
33 }
34
Popular Tags