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.wfs.kvp;
06:
07: import net.opengis.wfs.ResultTypeType;
08: import org.geoserver.ows.KvpParser;
09:
10: /**
11: * Parses a kvp of the form resultType=<hits|results>.
12: * <p>
13: * Allowable values are "hits", and "results", which get parsed into
14: * the following respectivley.
15: * <ul>
16: * <li>{@link net.opengis.wfs.ResultTypeType#HITS_LITERAL}
17: * <li>{@link net.opengis.wfs.ResultTypeType#RESULTS_LITERAL}
18: * </ul>
19: * </p>
20: * @author Justin Deoliveira, The Open Planning Project
21: *
22: */
23: public class ResultTypeKvpParser extends KvpParser {
24: public ResultTypeKvpParser() {
25: super ("resultType", ResultTypeType.class);
26: }
27:
28: public Object parse(String value) throws Exception {
29: if ("hits".equalsIgnoreCase(value)) {
30: return ResultTypeType.HITS_LITERAL;
31: }
32:
33: if ("results".equalsIgnoreCase(value)) {
34: return ResultTypeType.RESULTS_LITERAL;
35: }
36:
37: return null;
38: }
39: }
|