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.Calendar; 22 23 24 /** 25 * Corresponds to the XML Schema 26 * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#gMonth">xs:gMonth</a> type. 27 * A gMonth specifies only a month-of-year. 28 * <p> 29 * Convertible to {@link Calendar}, {@link GDate}, or an int. 30 * 31 * @see XmlCalendar 32 * @see GDate 33 */ 34 public interface XmlGMonth extends XmlAnySimpleType 35 { 36 /** The constant {@link SchemaType} object representing this schema type. */ 37 public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_gMonth"); 38 39 /** Returns this value as a {@link Calendar} */ 40 Calendar getCalendarValue(); 41 /** Sets this value as a {@link Calendar} */ 42 void setCalendarValue(Calendar c); 43 /** Returns this value as a {@link GDate} */ 44 GDate getGDateValue(); 45 /** Sets this value as a {@link GDateSpecification} */ 46 void setGDateValue(GDate gd); 47 /** Returns this value as an int from 1-12 */ 48 int getIntValue(); 49 /** Sets this value as an int from 1-12 */ 50 void setIntValue(int v); 51 52 /** 53 * Returns this value as a {@link Calendar} 54 * @deprecated replaced with {@link #getCalendarValue} 55 **/ 56 Calendar calendarValue(); 57 /** 58 * Sets this value as a {@link Calendar} 59 * @deprecated replaced with {@link #setCalendarValue} 60 **/ 61 void set(Calendar c); 62 /** 63 * Returns this value as a {@link GDate} 64 * @deprecated replaced with {@link #getGDateValue} 65 **/ 66 GDate gDateValue(); 67 /** 68 * Sets this value as a {@link GDateSpecification} 69 * @deprecated replaced with {@link #setGDateValue} 70 **/ 71 void set(GDateSpecification gd); 72 /** 73 * Returns this value as an int from 1-12 74 * @deprecated replaced with {@link #getIntValue} 75 **/ 76 int intValue(); 77 /** 78 * Sets this value as an int from 1-12 79 * @deprecated replaced with {@link #setIntValue} 80 **/ 81 void set(int v); 82 83 /** 84 * A class with methods for creating instances 85 * of {@link XmlGMonth}. 86 */ 87 public static final class Factory 88 { 89 /** Creates an empty instance of {@link XmlGMonth} */ 90 public static XmlGMonth newInstance() { 91 return (XmlGMonth) XmlBeans.getContextTypeLoader().newInstance( type, null ); } 92 93 /** Creates an empty instance of {@link XmlGMonth} */ 94 public static XmlGMonth newInstance(org.apache.xmlbeans.XmlOptions options) { 95 return (XmlGMonth) XmlBeans.getContextTypeLoader().newInstance( type, options ); } 96 97 /** Creates an immutable {@link XmlGMonth} value */ 98 public static XmlGMonth newValue(Object obj) { 99 return (XmlGMonth) type.newValue( obj ); } 100 101 /** Parses a {@link XmlGMonth} fragment from a String. For example: "<code><xml-fragment>--06</xml-fragment></code>". */ 102 public static XmlGMonth parse(java.lang.String s) throws org.apache.xmlbeans.XmlException { 103 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( s, type, null ); } 104 105 /** Parses a {@link XmlGMonth} fragment from a String. For example: "<code><xml-fragment>--06</xml-fragment></code>". */ 106 public static XmlGMonth parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { 107 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( s, type, options ); } 108 109 /** Parses a {@link XmlGMonth} fragment from a File. */ 110 public static XmlGMonth parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException { 111 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( f, type, null ); } 112 113 /** Parses a {@link XmlGMonth} fragment from a File. */ 114 public static XmlGMonth parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 115 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( f, type, options ); } 116 117 /** Parses a {@link XmlGMonth} fragment from a URL. */ 118 public static XmlGMonth parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException { 119 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( u, type, null ); } 120 121 /** Parses a {@link XmlGMonth} fragment from a URL. */ 122 public static XmlGMonth parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 123 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( u, type, options ); } 124 125 /** Parses a {@link XmlGMonth} fragment from an InputStream. */ 126 public static XmlGMonth parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException { 127 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( is, type, null ); } 128 129 /** Parses a {@link XmlGMonth} fragment from an InputStream. */ 130 public static XmlGMonth parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 131 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( is, type, options ); } 132 133 /** Parses a {@link XmlGMonth} fragment from a Reader. */ 134 public static XmlGMonth parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException { 135 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( r, type, null ); } 136 137 /** Parses a {@link XmlGMonth} fragment from a Reader. */ 138 public static XmlGMonth parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 139 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( r, type, options ); } 140 141 /** Parses a {@link XmlGMonth} fragment from a DOM Node. */ 142 public static XmlGMonth parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException { 143 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( node, type, null ); } 144 145 /** Parses a {@link XmlGMonth} fragment from a DOM Node. */ 146 public static XmlGMonth parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { 147 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( node, type, options ); } 148 149 /** Parses a {@link XmlGMonth} fragment from an XMLInputStream. 150 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 151 */ 152 public static XmlGMonth parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { 153 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( xis, type, null ); } 154 155 /** Parses a {@link XmlGMonth} fragment from an XMLInputStream. 156 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 157 */ 158 public static XmlGMonth parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { 159 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( xis, type, options ); } 160 161 /** Parses a {@link XmlGMonth} fragment from an XMLStreamReader. */ 162 public static XmlGMonth parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException { 163 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( xsr, type, null ); } 164 165 /** Parses a {@link XmlGMonth} fragment from an XMLStreamReader. */ 166 public static XmlGMonth parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException{ 167 return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( xsr, type, options ); } 168 169 /** Returns a validating XMLInputStream. 170 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 171 */ 172 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 { 173 return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); } 174 175 /** Returns a validating XMLInputStream. 176 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 177 */ 178 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 { 179 return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); } 180 181 private Factory() { } // No instance of this class allowed 182 } 183 } 184