KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > config > BooleanConfigParam


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: BooleanConfigParam.java,v 1.25 2006/11/06 20:36:56 linda Exp $
7  */

8
9 package com.sleepycat.je.config;
10
11 /**
12  * A JE configuration parameter with an boolean value.
13  */

14 public class BooleanConfigParam extends ConfigParam {
15     
16     private static final String JavaDoc DEBUG_NAME =
17         BooleanConfigParam.class.getName();
18
19     /**
20      * Set a boolean parameter w/default.
21      * @param configName
22      * @param defaultValue
23      * @param forReplication TODO
24      */

25     BooleanConfigParam(String JavaDoc configName,
26                        boolean defaultValue,
27                        boolean mutable,
28                        boolean forReplication,
29                        String JavaDoc description) {
30         // defaultValue must not be null
31
super(configName,
32           Boolean.valueOf(defaultValue).toString(),
33               mutable,
34               forReplication,
35               description);
36     }
37
38     /**
39      * Make sure that value is a valid string for booleans.
40      */

41     public void validateValue(String JavaDoc value)
42         throws IllegalArgumentException JavaDoc {
43
44         if (!value.trim().equalsIgnoreCase(Boolean.FALSE.toString()) &&
45             !value.trim().equalsIgnoreCase(Boolean.TRUE.toString())) {
46             throw new IllegalArgumentException JavaDoc
47         (DEBUG_NAME + ": " + value + " not valid boolean " + name);
48         }
49     }
50 }
51
Popular Tags