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 java.util.List;
19: import javax.xml.namespace.QName;
20: import org.geotools.xml.AbstractSimpleBinding;
21: import org.geotools.xml.InstanceComponent;
22:
23: /**
24: * Binding object for the type http://www.opengis.net/gml:doubleList.
25: *
26: * <p>
27: * <pre>
28: * <code>
29: * <simpleType name="doubleList">
30: * <annotation>
31: * <documentation>XML List based on XML Schema double type. An element of this type contains a space-separated list of double values</documentation>
32: * </annotation>
33: * <list itemType="double"/>
34: * </simpleType>
35: *
36: * </code>
37: * </pre>
38: * </p>
39: *
40: * @generated
41: */
42: public class DoubleListBinding extends AbstractSimpleBinding {
43: /**
44: * @generated
45: */
46: public QName getTarget() {
47: return GML.doubleList;
48: }
49:
50: public int getExecutionMode() {
51: return OVERRIDE;
52: }
53:
54: /**
55: * <!-- begin-user-doc -->
56: * <!-- end-user-doc -->
57: *
58: * @generated modifiable
59: */
60: public Class getType() {
61: //return double[].class;
62: return Double[].class;
63: }
64:
65: /**
66: * <!-- begin-user-doc -->
67: * <!-- end-user-doc -->
68: *
69: * @generated modifiable
70: */
71: public Object parse(InstanceComponent instance, Object value)
72: throws Exception {
73: List list = (List) value;
74:
75: return list.toArray(new Double[list.size()]);
76:
77: // String[] values = ((String) value).split(" +");
78: // double[] doubles = new double[values.length];
79: //
80: // for (int i = 0; i < values.length; i++) {
81: // doubles[i] = Double.parseDouble(values[i]);
82: // }
83: //
84: // return doubles;
85: }
86: }
|