Source code: com/eireneh/config/choices/BooleanChoice.java
1
2 package com.eireneh.config.choices;
3
4 import com.eireneh.util.*;
5 import com.eireneh.config.*;
6
7 /**
8 * BooleanChoice.
9 *
10 * <table border='1' cellPadding='3' cellSpacing='0' width="100%">
11 * <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
12 * Distribution Licence:<br />
13 * Project B is free software; you can redistribute it
14 * and/or modify it under the terms of the GNU General Public License,
15 * version 2 as published by the Free Software Foundation.<br />
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.<br />
20 * The License is available on the internet
21 * <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
22 * <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
23 * MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
24 * The copyright to this program is held by it's authors.
25 * </font></td></tr></table>
26 * @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
27 * @see docs.Licence
28 * @author Joe Walker
29 */
30 public abstract class BooleanChoice extends AbstractChoice
31 {
32 /**
33 * Generalized read boolean from the Properties file
34 * @return Found boolean or the default value
35 */
36 public abstract boolean getBoolean();
37
38 /**
39 * Generalized set boolean to the Properties file
40 * @param value The value to enter
41 */
42 public abstract void setBoolean(boolean value) throws Exception;
43
44 /**
45 * Generalized read boolean from the Properties file
46 * @return Found boolean or the default value
47 */
48 public String getString()
49 {
50 return Convert.boolean2String(getBoolean());
51 }
52
53 /**
54 * Generalized set boolean to the Properties file
55 * @param value The value to enter
56 */
57 public void setString(String value) throws Exception
58 {
59 setBoolean(Convert.string2Boolean(value));
60 }
61
62 /** Override this to check and note any change */
63 public String getType()
64 {
65 return "boolean";
66 }
67 }
68