/*
* GeoTools - The Open Source Java GIS Toolkit
* http://geotools.org
*
* (C) 2002-2008, Open Source Geospatial Foundation (OSGeo)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
package org.geotools.gml3.bindings;
import java.util.List;
import javax.xml.namespace.QName;
import org.geotools.gml3.GML;
import org.geotools.xml.AbstractSimpleBinding;
import org.geotools.xml.InstanceComponent;
/**
* Binding object for the type http://www.opengis.net/gml:doubleList.
*
* <p>
* <pre>
* <code>
* <simpleType name="doubleList">
* <annotation>
* <documentation>XML List based on XML Schema double type. An element of this type contains a space-separated list of double values</documentation>
* </annotation>
* <list itemType="double"/>
* </simpleType>
*
* </code>
* </pre>
* </p>
*
* @generated
*
* @source $URL$
*/
public class DoubleListBinding extends AbstractSimpleBinding {
/**
* @generated
*/
public QName getTarget() {
return GML.doubleList;
}
public int getExecutionMode() {
return OVERRIDE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated modifiable
*/
public Class getType() {
//return double[].class;
return Double[].class;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated modifiable
*/
public Object parse(InstanceComponent instance, Object value)
throws Exception {
List list = (List) value;
return list.toArray(new Double[list.size()]);
// String[] values = ((String) value).split(" +");
// double[] doubles = new double[values.length];
//
// for (int i = 0; i < values.length; i++) {
// doubles[i] = Double.parseDouble(values[i]);
// }
//
// return doubles;
}
}