001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.filter.v1_0;
017:
018: import org.picocontainer.MutablePicoContainer;
019: import javax.xml.namespace.QName;
020: import org.opengis.filter.FilterFactory;
021: import org.opengis.filter.PropertyIsBetween;
022: import org.opengis.filter.expression.Expression;
023: import org.geotools.xml.AbstractComplexBinding;
024: import org.geotools.xml.ElementInstance;
025: import org.geotools.xml.Node;
026:
027: /**
028: * Binding object for the type http://www.opengis.net/ogc:PropertyIsBetweenType.
029: *
030: * <p>
031: * <pre>
032: * <code>
033: * <xsd:complexType name="PropertyIsBetweenType">
034: * <xsd:complexContent>
035: * <xsd:extension base="ogc:ComparisonOpsType">
036: * <xsd:sequence>
037: * <xsd:element ref="ogc:expression"/>
038: * <xsd:element name="LowerBoundary" type="ogc:LowerBoundaryType"/>
039: * <xsd:element name="UpperBoundary" type="ogc:UpperBoundaryType"/>
040: * </xsd:sequence>
041: * </xsd:extension>
042: * </xsd:complexContent>
043: * </xsd:complexType>
044: *
045: * </code>
046: * </pre>
047: * </p>
048: *
049: * @generated
050: */
051: public class OGCPropertyIsBetweenTypeBinding extends
052: AbstractComplexBinding {
053: private FilterFactory factory;
054:
055: public OGCPropertyIsBetweenTypeBinding(FilterFactory factory) {
056: this .factory = factory;
057: }
058:
059: /**
060: * @generated
061: */
062: public QName getTarget() {
063: return OGC.PropertyIsBetweenType;
064: }
065:
066: /**
067: * <!-- begin-user-doc -->
068: * <!-- end-user-doc -->
069: *
070: * @generated modifiable
071: */
072: public Class getType() {
073: return PropertyIsBetween.class;
074: }
075:
076: /**
077: * <!-- begin-user-doc -->
078: * <!-- end-user-doc -->
079: *
080: * @generated modifiable
081: */
082: public void initialize(ElementInstance instance, Node node,
083: MutablePicoContainer context) {
084: }
085:
086: /**
087: * <!-- begin-user-doc -->
088: * <!-- end-user-doc -->
089: *
090: * @generated modifiable
091: */
092: public Object parse(ElementInstance instance, Node node,
093: Object value) throws Exception {
094: Expression e = (Expression) node.getChildValue(0);
095: Expression l = (Expression) node.getChildValue(1);
096: Expression u = (Expression) node.getChildValue(2);
097:
098: return factory.between(e, l, u);
099: }
100:
101: public Object getProperty(Object object, QName name)
102: throws Exception {
103: PropertyIsBetween between = (PropertyIsBetween) object;
104:
105: //<xsd:element ref="ogc:expression"/>
106: if (OGC.expression.equals(name)) {
107: return between.getExpression();
108: }
109:
110: //<xsd:element name="LowerBoundary" type="ogc:LowerBoundaryType"/>
111: if ("LowerBoundary".equals(name.getLocalPart())) {
112: return between.getLowerBoundary();
113: }
114:
115: //<xsd:element name="UpperBoundary" type="ogc:UpperBoundaryType"/>
116: if ("UpperBoundary".equals(name.getLocalPart())) {
117: return between.getUpperBoundary();
118: }
119:
120: return null;
121: }
122: }
|