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