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_1;
17:
18: import javax.xml.namespace.QName;
19: import org.opengis.filter.FilterFactory;
20: import org.opengis.filter.sort.SortOrder;
21: import org.geotools.xml.AbstractSimpleBinding;
22: import org.geotools.xml.InstanceComponent;
23:
24: /**
25: * Binding object for the type http://www.opengis.net/ogc:SortOrderType.
26: *
27: * <p>
28: * <pre>
29: * <code>
30: * <xsd:simpleType name="SortOrderType">
31: * <xsd:restriction base="xsd:string">
32: * <xsd:enumeration value="DESC"/>
33: * <xsd:enumeration value="ASC"/>
34: * </xsd:restriction>
35: * </xsd:simpleType>
36: *
37: * </code>
38: * </pre>
39: * </p>
40: *
41: * @generated
42: */
43: public class SortOrderTypeBinding extends AbstractSimpleBinding {
44: FilterFactory filterfactory;
45:
46: public SortOrderTypeBinding(FilterFactory filterfactory) {
47: this .filterfactory = filterfactory;
48: }
49:
50: /**
51: * @generated
52: */
53: public QName getTarget() {
54: return OGC.SortOrderType;
55: }
56:
57: /**
58: * <!-- begin-user-doc -->
59: * <!-- end-user-doc -->
60: *
61: * @generated modifiable
62: */
63: public Class getType() {
64: return SortOrder.class;
65: }
66:
67: /**
68: * <!-- begin-user-doc -->
69: * <!-- end-user-doc -->
70: *
71: * @generated modifiable
72: */
73: public Object parse(InstanceComponent instance, Object value)
74: throws Exception {
75: if ("ASC".equals(value)) {
76: return SortOrder.ASCENDING;
77: }
78:
79: if ("DESC".equals(value)) {
80: return SortOrder.DESCENDING;
81: }
82:
83: return null;
84: }
85: }
|