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.xs.bindings;
017:
018: import java.net.URI;
019:
020: import javax.xml.namespace.QName;
021:
022: import org.geotools.xml.InstanceComponent;
023: import org.geotools.xml.SimpleBinding;
024:
025: /**
026: * Binding object for the type http://www.w3.org/2001/XMLSchema:anyURI.
027: *
028: * <p>
029: * <pre>
030: * <code>
031: * <xs:simpleType name="anyURI" id="anyURI">
032: * <xs:annotation>
033: * <xs:appinfo>
034: * <hfp:hasFacet name="length"/>
035: * <hfp:hasFacet name="minLength"/>
036: * <hfp:hasFacet name="maxLength"/>
037: * <hfp:hasFacet name="pattern"/>
038: * <hfp:hasFacet name="enumeration"/>
039: * <hfp:hasFacet name="whiteSpace"/>
040: * <hfp:hasProperty name="ordered" value="false"/>
041: * <hfp:hasProperty name="bounded" value="false"/>
042: * <hfp:hasProperty name="cardinality" value="countably infinite"/>
043: * <hfp:hasProperty name="numeric" value="false"/>
044: * </xs:appinfo>
045: * <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#anyURI"/>
046: * </xs:annotation>
047: * <xs:restriction base="xs:anySimpleType">
048: * <xs:whiteSpace value="collapse" fixed="true" id="anyURI.whiteSpace"/>
049: * </xs:restriction>
050: * </xs:simpleType>
051: *
052: * </code>
053: * </pre>
054: * </p>
055: *
056: * @generated
057: */
058: public class XSAnyURIBinding implements SimpleBinding {
059: /**
060: * @generated
061: */
062: public QName getTarget() {
063: return XS.ANYURI;
064: }
065:
066: /**
067: * <!-- begin-user-doc -->
068: * <!-- end-user-doc -->
069: *
070: * @generated modifiable
071: */
072: public int getExecutionMode() {
073: return OVERRIDE;
074: }
075:
076: /**
077: * <!-- begin-user-doc -->
078: * This binding returns objects of type {@link URI}.
079: * <!-- end-user-doc -->
080: *
081: * @generated modifiable
082: */
083: public Class getType() {
084: return URI.class;
085: }
086:
087: /**
088: * <!-- begin-user-doc -->
089: * This binding returns objects of type {@link URI}.
090: * <!-- end-user-doc -->
091: *
092: * @generated modifiable
093: */
094: public Object parse(InstanceComponent instance, Object value)
095: throws Exception {
096: return new URI((String) value);
097: }
098:
099: /**
100: * <!-- begin-user-doc -->
101: * <!-- end-user-doc -->
102: *
103: * @generated modifiable
104: */
105: public String encode(Object object, String value) {
106: URI uri = (URI) object;
107:
108: return uri.toString();
109: }
110: }
|