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.filter.v1_0;
17:
18: import org.picocontainer.MutablePicoContainer;
19: import org.w3c.dom.Document;
20: import org.w3c.dom.Element;
21: import javax.xml.namespace.QName;
22: import org.geotools.xml.AbstractComplexBinding;
23: import org.geotools.xml.ElementInstance;
24: import org.geotools.xml.Node;
25:
26: /**
27: * Binding object for the type http://www.opengis.net/ogc:DistanceType.
28: *
29: * <p>
30: * <pre>
31: * <code>
32: * <xsd:complexType mixed="true" name="DistanceType">
33: * <xsd:attribute name="units" type="xsd:string" use="required"/>
34: * </xsd:complexType>
35: *
36: * </code>
37: * </pre>
38: * </p>
39: *
40: * @generated
41: */
42: public class OGCDistanceTypeBinding extends AbstractComplexBinding {
43: /**
44: * @generated
45: */
46: public QName getTarget() {
47: return OGC.DistanceType;
48: }
49:
50: /**
51: * <!-- begin-user-doc -->
52: * <!-- end-user-doc -->
53: *
54: * @generated modifiable
55: */
56: public int getExecutionMode() {
57: return OVERRIDE;
58: }
59:
60: /**
61: * <!-- begin-user-doc -->
62: * <!-- end-user-doc -->
63: *
64: * @generated modifiable
65: */
66: public Class getType() {
67: return Double.class;
68: }
69:
70: /**
71: * <!-- begin-user-doc -->
72: * <!-- end-user-doc -->
73: *
74: * @generated modifiable
75: */
76: public void initialize(ElementInstance instance, Node node,
77: MutablePicoContainer context) {
78: }
79:
80: /**
81: * <!-- begin-user-doc -->
82: * <!-- end-user-doc -->
83: *
84: * @generated modifiable
85: */
86: public Object parse(ElementInstance instance, Node node,
87: Object value) throws Exception {
88: //TODO: return some object capable of representing units
89: return Double.valueOf((String) value);
90: }
91:
92: public Element encode(Object object, Document document,
93: Element value) throws Exception {
94: Double distance = (Double) object;
95: value.appendChild(document.createTextNode(distance.toString()));
96:
97: return value;
98: }
99: }
|