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.ows.AcceptVersionsType;
08: import net.opengis.ows.OwsFactory;
09: import org.geoserver.ows.KvpParser;
10: import org.geoserver.ows.util.KvpUtils;
11:
12: /**
13: * Parses a kvp of the form "acceptVersions=version1,version2,...,versionN" into
14: * an instance of {@link net.opengis.ows.v1_0_0.AcceptVersionsType}.
15: *
16: * @author Justin Deoliveira, The Open Planning Project
17: *
18: */
19: public class AcceptVersionsKvpParser extends KvpParser {
20: public AcceptVersionsKvpParser() {
21: super ("acceptversions", AcceptVersionsType.class);
22: }
23:
24: public Object parse(String value) throws Exception {
25: AcceptVersionsType acceptVersions = OwsFactory.eINSTANCE
26: .createAcceptVersionsType();
27: acceptVersions.getVersion().addAll(
28: KvpUtils.readFlat(value, KvpUtils.INNER_DELIMETER));
29:
30: return acceptVersions;
31: }
32: }
|