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/#positiveInteger">xs:positiveInteger</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 * Verified to be positive when validating. 27 * <p> 28 * Convertible to {@link java.math.BigInteger}. 29 */ 30 public interface XmlPositiveInteger extends XmlNonNegativeInteger 31 { 32 /** The constant {@link SchemaType} object representing this schema type. */ 33 public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_positiveInteger"); 34 35 /** 36 * A class with methods for creating instances 37 * of {@link XmlPositiveInteger}. 38 */ 39 public static final class Factory 40 { 41 /** Creates an empty instance of {@link XmlPositiveInteger} */ 42 public static XmlPositiveInteger newInstance() { 43 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().newInstance( type, null ); } 44 45 /** Creates an empty instance of {@link XmlPositiveInteger} */ 46 public static XmlPositiveInteger newInstance(org.apache.xmlbeans.XmlOptions options) { 47 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().newInstance( type, options ); } 48 49 /** Creates an immutable {@link XmlPositiveInteger} value */ 50 public static XmlPositiveInteger newValue(Object obj) { 51 return (XmlPositiveInteger) type.newValue( obj ); } 52 53 /** Parses a {@link XmlPositiveInteger} fragment from a String. For example: "<code><xml-fragment>1234567890</xml-fragment></code>". */ 54 public static XmlPositiveInteger parse(java.lang.String s) throws org.apache.xmlbeans.XmlException { 55 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( s, type, null ); } 56 57 /** Parses a {@link XmlPositiveInteger} fragment from a String. For example: "<code><xml-fragment>1234567890</xml-fragment></code>". */ 58 public static XmlPositiveInteger parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { 59 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( s, type, options ); } 60 61 /** Parses a {@link XmlPositiveInteger} fragment from a File. */ 62 public static XmlPositiveInteger parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException { 63 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( f, type, null ); } 64 65 /** Parses a {@link XmlPositiveInteger} fragment from a File. */ 66 public static XmlPositiveInteger parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 67 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( f, type, options ); } 68 69 /** Parses a {@link XmlPositiveInteger} fragment from a URL. */ 70 public static XmlPositiveInteger parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException { 71 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( u, type, null ); } 72 73 /** Parses a {@link XmlPositiveInteger} fragment from a URL. */ 74 public static XmlPositiveInteger parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 75 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( u, type, options ); } 76 77 /** Parses a {@link XmlPositiveInteger} fragment from an InputStream. */ 78 public static XmlPositiveInteger parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException { 79 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( is, type, null ); } 80 81 /** Parses a {@link XmlPositiveInteger} fragment from an InputStream. */ 82 public static XmlPositiveInteger parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 83 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( is, type, options ); } 84 85 /** Parses a {@link XmlPositiveInteger} fragment from a Reader. */ 86 public static XmlPositiveInteger parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException { 87 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( r, type, null ); } 88 89 /** Parses a {@link XmlPositiveInteger} fragment from a Reader. */ 90 public static XmlPositiveInteger parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 91 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( r, type, options ); } 92 93 /** Parses a {@link XmlPositiveInteger} fragment from a DOM Node. */ 94 public static XmlPositiveInteger parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException { 95 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( node, type, null ); } 96 97 /** Parses a {@link XmlPositiveInteger} fragment from a DOM Node. */ 98 public static XmlPositiveInteger parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { 99 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( node, type, options ); } 100 101 /** Parses a {@link XmlPositiveInteger} fragment from an XMLInputStream. 102 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 103 */ 104 public static XmlPositiveInteger parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { 105 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( xis, type, null ); } 106 107 /** Parses a {@link XmlPositiveInteger} fragment from an XMLInputStream. 108 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 109 */ 110 public static XmlPositiveInteger parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { 111 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( xis, type, options ); } 112 113 /** Parses a {@link XmlPositiveInteger} fragment from an XMLStreamReader. */ 114 public static XmlPositiveInteger parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException { 115 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( xsr, type, null ); } 116 117 /** Parses a {@link XmlPositiveInteger} fragment from an XMLStreamReader. */ 118 public static XmlPositiveInteger parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException{ 119 return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( xsr, type, options ); } 120 121 /** Returns a validating XMLInputStream. 122 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 123 */ 124 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 { 125 return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); } 126 127 /** Returns a validating XMLInputStream. 128 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 129 */ 130 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 { 131 return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); } 132 133 private Factory() { } // No instance of this class allowed 134 } 135 } 136