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 /** 22 * Corresponds to the XML Schema 23 * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#int">xs:int</a> type. 24 * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#decimal">xs:decimal</a>. 25 * <p> 26 * Naturally, convertible to a Java int. 27 */ 28 public interface XmlInt extends XmlLong 29 { 30 /** The constant {@link SchemaType} object representing this schema type. */ 31 public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_int"); 32 33 /** Returns this value as an int */ 34 int getIntValue(); 35 /** Sets this value as an int */ 36 void setIntValue(int v); 37 38 /** 39 * Returns this value as an int 40 * @deprecated replaced with {@link #getIntValue} 41 **/ 42 int intValue(); 43 /** 44 * Sets this value as an int 45 * @deprecated replaced with {@link #setIntValue} 46 **/ 47 void set(int v); 48 49 /** 50 * A class with methods for creating instances 51 * of {@link XmlInt}. 52 */ 53 public static final class Factory 54 { 55 /** Creates an empty instance of {@link XmlInt} */ 56 public static XmlInt newInstance() { 57 return (XmlInt) XmlBeans.getContextTypeLoader().newInstance( type, null ); } 58 59 /** Creates an empty instance of {@link XmlInt} */ 60 public static XmlInt newInstance(org.apache.xmlbeans.XmlOptions options) { 61 return (XmlInt) XmlBeans.getContextTypeLoader().newInstance( type, options ); } 62 63 /** Creates an immutable {@link XmlInt} value */ 64 public static XmlInt newValue(Object obj) { 65 return (XmlInt) type.newValue( obj ); } 66 67 /** Parses a {@link XmlInt} fragment from a String. For example: "<code><xml-fragment>1234567</xml-fragment></code>". */ 68 public static XmlInt parse(java.lang.String s) throws org.apache.xmlbeans.XmlException { 69 return (XmlInt) XmlBeans.getContextTypeLoader().parse( s, type, null ); } 70 71 /** Parses a {@link XmlInt} fragment from a String. For example: "<code><xml-fragment>1234567</xml-fragment></code>". */ 72 public static XmlInt parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { 73 return (XmlInt) XmlBeans.getContextTypeLoader().parse( s, type, options ); } 74 75 /** Parses a {@link XmlInt} fragment from a File. */ 76 public static XmlInt parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException { 77 return (XmlInt) XmlBeans.getContextTypeLoader().parse( f, type, null ); } 78 79 /** Parses a {@link XmlInt} fragment from a File. */ 80 public static XmlInt parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 81 return (XmlInt) XmlBeans.getContextTypeLoader().parse( f, type, options ); } 82 83 /** Parses a {@link XmlInt} fragment from a URL. */ 84 public static XmlInt parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException { 85 return (XmlInt) XmlBeans.getContextTypeLoader().parse( u, type, null ); } 86 87 /** Parses a {@link XmlInt} fragment from a URL. */ 88 public static XmlInt parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 89 return (XmlInt) XmlBeans.getContextTypeLoader().parse( u, type, options ); } 90 91 /** Parses a {@link XmlInt} fragment from an InputStream. */ 92 public static XmlInt parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException { 93 return (XmlInt) XmlBeans.getContextTypeLoader().parse( is, type, null ); } 94 95 /** Parses a {@link XmlInt} fragment from an InputStream. */ 96 public static XmlInt parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 97 return (XmlInt) XmlBeans.getContextTypeLoader().parse( is, type, options ); } 98 99 /** Parses a {@link XmlInt} fragment from a Reader. */ 100 public static XmlInt parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException { 101 return (XmlInt) XmlBeans.getContextTypeLoader().parse( r, type, null ); } 102 103 /** Parses a {@link XmlInt} fragment from a Reader. */ 104 public static XmlInt parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 105 return (XmlInt) XmlBeans.getContextTypeLoader().parse( r, type, options ); } 106 107 /** Parses a {@link XmlInt} fragment from a DOM Node. */ 108 public static XmlInt parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException { 109 return (XmlInt) XmlBeans.getContextTypeLoader().parse( node, type, null ); } 110 111 /** Parses a {@link XmlInt} fragment from a DOM Node. */ 112 public static XmlInt parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { 113 return (XmlInt) XmlBeans.getContextTypeLoader().parse( node, type, options ); } 114 115 /** Parses a {@link XmlInt} fragment from an XMLInputStream. 116 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 117 */ 118 public static XmlInt parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { 119 return (XmlInt) XmlBeans.getContextTypeLoader().parse( xis, type, null ); } 120 121 /** Parses a {@link XmlInt} fragment from an XMLInputStream. 122 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 123 */ 124 public static XmlInt parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { 125 return (XmlInt) XmlBeans.getContextTypeLoader().parse( xis, type, options ); } 126 127 /** Parses a {@link XmlInt} fragment from an XMLStreamReader. */ 128 public static XmlInt parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException { 129 return (XmlInt) XmlBeans.getContextTypeLoader().parse( xsr, type, null ); } 130 131 /** Parses a {@link XmlInt} fragment from an XMLStreamReader. */ 132 public static XmlInt parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException{ 133 return (XmlInt) XmlBeans.getContextTypeLoader().parse( xsr, type, options ); } 134 135 /** Returns a validating XMLInputStream. 136 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 137 */ 138 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 { 139 return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); } 140 141 /** Returns a validating XMLInputStream. 142 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 143 */ 144 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 { 145 return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); } 146 147 private Factory() { } // No instance of this class allowed 148 } 149 } 150