01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.gml3.bindings;
17:
18: import javax.xml.namespace.QName;
19: import org.geotools.xml.*;
20:
21: /**
22: * Binding object for the type http://www.opengis.net/gml:integerList.
23: *
24: * <p>
25: * <pre>
26: * <code>
27: * <simpleType name="integerList">
28: * <annotation>
29: * <documentation>XML List based on XML Schema integer type. An element of this type contains a space-separated list of integer values</documentation>
30: * </annotation>
31: * <list itemType="integer"/>
32: * </simpleType>
33: *
34: * </code>
35: * </pre>
36: * </p>
37: *
38: * @generated
39: */
40: public class IntegerListBinding extends AbstractSimpleBinding {
41: /**
42: * @generated
43: */
44: public QName getTarget() {
45: return GML.integerList;
46: }
47:
48: /**
49: * <!-- begin-user-doc -->
50: * <!-- end-user-doc -->
51: *
52: * @generated modifiable
53: */
54: public Class getType() {
55: return int[].class;
56: }
57:
58: /**
59: * <!-- begin-user-doc -->
60: * <!-- end-user-doc -->
61: *
62: * @generated modifiable
63: */
64: public Object parse(InstanceComponent instance, Object value)
65: throws Exception {
66: String[] values = ((String) value).split(" +");
67: int[] integers = new int[values.length];
68:
69: for (int i = 0; i < values.length; i++) {
70: integers[i] = Integer.parseInt(values[i]);
71: }
72:
73: return integers;
74: }
75: }
|