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