Home » xmlbeans-2.5.0-src » org.apache » xmlbeans » [javadoc | source]

    1   /*   Copyright 2004 The Apache Software Foundation
    2    *
    3    *   Licensed under the Apache License, Version 2.0 (the "License");
    4    *   you may not use this file except in compliance with the License.
    5    *   You may obtain a copy of the License at
    6    *
    7    *       http://www.apache.org/licenses/LICENSE-2.0
    8    *
    9    *   Unless required by applicable law or agreed to in writing, software
   10    *   distributed under the License is distributed on an "AS IS" BASIS,
   11    *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   12    *   See the License for the specific language governing permissions and
   13    *  limitations under the License.
   14    */
   15   
   16   package org.apache.xmlbeans;
   17   
   18   import javax.xml.stream.XMLStreamReader;
   19   
   20   
   21   import java.util.Date;
   22   import java.util.Calendar;
   23   
   24   
   25   /**
   26    * Corresponds to the XML Schema
   27    * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#dateTime">xs:dateTime</a> type.
   28    * <p>
   29    * Convertible to {@link Calendar}, {@link Date}, and {@link GDate}.
   30    *
   31    * <p>
   32    * The XmlDateTime class only encapsulates a schema DateTime value, if you need to perform operations
   33    * on dates, see the GDate class
   34    * @see XmlCalendar
   35    * @see GDate
   36    * @see GDuration
   37    */ 
   38   public interface XmlDateTime extends XmlAnySimpleType
   39   {
   40       /** The constant {@link SchemaType} object representing this schema type. */
   41       public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_dateTime");
   42       
   43       /**
   44        * Returns this value as a {@link Calendar}
   45        * @deprecated replaced with {@link #getCalendarValue}
   46        **/
   47       Calendar calendarValue();
   48       /**
   49        * Sets this value as a {@link Calendar}
   50        * @deprecated replaced with {@link #setCalendarValue}
   51        **/
   52       void set(Calendar c);
   53       /**
   54        * Returns this value as a {@link GDate}
   55        * @deprecated replaced with {@link #getGDateValue}
   56        **/
   57       GDate gDateValue();
   58       /**
   59        * Sets this value as a {@link GDateSpecification}
   60        * @deprecated replaced with {@link #setGDateValue}
   61        **/
   62       void set(GDateSpecification gd);
   63       /**
   64        * Returns this value as a {@link Date}
   65        * @deprecated replaced with {@link #getDateValue}
   66        **/
   67       Date dateValue();
   68       /**
   69        * Sets this value as a {@link Date}
   70        * @deprecated replaced with {@link #setDateValue}
   71        **/
   72       void set(Date d);
   73   
   74       /** Returns this value as a {@link Calendar} */
   75       Calendar getCalendarValue();
   76       /** Sets this value as a {@link Calendar} */
   77       void setCalendarValue(Calendar c);
   78       /** Returns this value as a {@link GDate} */
   79       GDate getGDateValue();
   80       /** Sets this value as a {@link GDateSpecification} */
   81       void setGDateValue(GDate gd);
   82       /** Returns this value as a {@link Date} */
   83       Date getDateValue();
   84       /** Sets this value as a {@link Date} */
   85       void setDateValue(Date d);
   86   
   87       /**
   88        * A class with methods for creating instances
   89        * of {@link XmlDateTime}.
   90        */
   91       public static final class Factory
   92       {
   93           /** Creates an empty instance of {@link XmlDateTime} */
   94           public static XmlDateTime newInstance() {
   95             return (XmlDateTime) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
   96           
   97           /** Creates an empty instance of {@link XmlDateTime} */
   98           public static XmlDateTime newInstance(org.apache.xmlbeans.XmlOptions options) {
   99             return (XmlDateTime) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
  100           
  101           /** Creates an immutable {@link XmlDateTime} value */
  102           public static XmlDateTime newValue(Object obj) {
  103             return (XmlDateTime) type.newValue( obj ); }
  104           
  105           /** Parses a {@link XmlDateTime} fragment from a String. For example: "<code>&lt;xml-fragment&gt;2003-06-14T12:00:00&lt;/xml-fragment&gt;</code>". */
  106           public static XmlDateTime parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
  107             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
  108           
  109           /** Parses a {@link XmlDateTime} fragment from a String. For example: "<code>&lt;xml-fragment&gt;2003-06-14T12:00:00&lt;/xml-fragment&gt;</code>". */
  110           public static XmlDateTime parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
  111             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
  112           
  113           /** Parses a {@link XmlDateTime} fragment from a File. */
  114           public static XmlDateTime parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
  115             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
  116           
  117           /** Parses a {@link XmlDateTime} fragment from a File. */
  118           public static XmlDateTime parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
  119             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
  120           
  121           /** Parses a {@link XmlDateTime} fragment from a URL. */
  122           public static XmlDateTime parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
  123             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
  124   
  125           /** Parses a {@link XmlDateTime} fragment from a URL. */
  126           public static XmlDateTime parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
  127             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
  128   
  129           /** Parses a {@link XmlDateTime} fragment from an InputStream. */
  130           public static XmlDateTime parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
  131             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
  132           
  133           /** Parses a {@link XmlDateTime} fragment from an InputStream. */
  134           public static XmlDateTime parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
  135             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
  136           
  137           /** Parses a {@link XmlDateTime} fragment from a Reader. */
  138           public static XmlDateTime parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
  139             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
  140           
  141           /** Parses a {@link XmlDateTime} fragment from a Reader. */
  142           public static XmlDateTime parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
  143             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
  144           
  145           /** Parses a {@link XmlDateTime} fragment from a DOM Node. */
  146           public static XmlDateTime parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
  147             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
  148           
  149           /** Parses a {@link XmlDateTime} fragment from a DOM Node. */
  150           public static XmlDateTime parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
  151             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
  152           
  153           /** Parses a {@link XmlDateTime} fragment from an XMLInputStream.
  154            * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
  155            */
  156           public static XmlDateTime parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
  157             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
  158           
  159           /** Parses a {@link XmlDateTime} fragment from an XMLInputStream.
  160            * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
  161            */
  162           public static XmlDateTime parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
  163             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
  164           
  165           /** Parses a {@link XmlDateTime} fragment from an XMLStreamReader. */
  166           public static XmlDateTime parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException {
  167             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( xsr, type, null ); }
  168           
  169           /** Parses a {@link XmlDateTime} fragment from an XMLStreamReader. */
  170           public static XmlDateTime parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException{
  171             return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( xsr, type, options ); }
  172           
  173           /** Returns a validating XMLInputStream.
  174            * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
  175            */
  176           public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
  177             return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
  178           
  179           /** Returns a validating XMLInputStream.
  180            * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
  181            */
  182           public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
  183             return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
  184           
  185           private Factory() { } // No instance of this class allowed
  186       }
  187   }
  188   

Home » xmlbeans-2.5.0-src » org.apache » xmlbeans » [javadoc | source]