KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > gumby > tags > types > BooleanTag


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

18 public class BooleanTag extends AbstractTypeTag {
19
20   /**
21    * @see org.sapia.gumby.tags.types.AbstractTypeTag#doProcessValue(java.lang.String)
22    */

23   protected Object JavaDoc doProcessValue(String JavaDoc value) {
24     if(value == null)
25       return new Boolean JavaDoc(false);
26     value = value.toLowerCase();
27     boolean b = value.equals("true") || value.equals("on")
28         || value.startsWith("y");
29     return new Boolean JavaDoc(b);
30   }
31
32 }
33
Popular Tags