01: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
02: * This code is licensed under the GPL 2.0 license, availible at the root
03: * application directory.
04: */
05: package org.geoserver.ows.kvp;
06:
07: import com.sun.xml.bind.DatatypeConverterImpl;
08: import org.geoserver.ows.KvpParser;
09:
10: /**
11: * Parses double kvp's of the form 'key=<boolean>'.
12: * <p>
13: *
14: * </p>
15: * @author Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
16: *
17: */
18: public class BooleanKvpParser extends KvpParser {
19: /**
20: * Creates the parser specifying the name of the key to latch to.
21: *
22: * @param key The key whose associated value to parse.
23: */
24: public BooleanKvpParser(String key) {
25: super (key, Boolean.class);
26: }
27:
28: public Object parse(String value) throws Exception {
29: return Boolean.valueOf(DatatypeConverterImpl.theInstance
30: .parseBoolean(value.toLowerCase()));
31: }
32: }
|