001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    package javax.xml.bind;
018    
019    import java.util.Calendar;
020    import java.math.BigInteger;
021    import java.math.BigDecimal;
022    
023    import javax.xml.namespace.QName;
024    import javax.xml.namespace.NamespaceContext;
025    
026    public final class DatatypeConverter {
027    
028        private static DatatypeConverterInterface converter = null;
029    
030        private DatatypeConverter() {
031        }
032    
033        public static void setDatatypeConverter(DatatypeConverterInterface converter) {
034            if (converter == null) {
035                throw new IllegalArgumentException("The DatatypeConverterInterface parameter must not be null");
036            }
037            if (DatatypeConverter.converter == null) {
038                DatatypeConverter.converter = converter;
039            }
040        }
041    
042        public static String parseString(String lexicalXSDString) {
043            return converter.parseString(lexicalXSDString);
044        }
045    
046        public static BigInteger parseInteger(String lexicalXSDInteger) {
047            return converter.parseInteger(lexicalXSDInteger);
048        }
049    
050        public static int parseInt(String lexicalXSDInt) {
051            return converter.parseInt(lexicalXSDInt);
052        }
053    
054        public static long parseLong(String lexicalXSDLong) {
055            return converter.parseLong(lexicalXSDLong);
056        }
057    
058        public static short parseShort(String lexicalXSDShort) {
059            return converter.parseShort(lexicalXSDShort);
060        }
061    
062        public static BigDecimal parseDecimal(String lexicalXSDDecimal) {
063            return converter.parseDecimal(lexicalXSDDecimal);
064        }
065    
066        public static float parseFloat(String lexicalXSDFloat) {
067            return converter.parseFloat(lexicalXSDFloat);
068        }
069    
070        public static double parseDouble(String lexicalXSDDouble) {
071            return converter.parseDouble(lexicalXSDDouble);
072        }
073    
074        public static boolean parseBoolean(String lexicalXSDBoolean) {
075            return converter.parseBoolean(lexicalXSDBoolean);
076        }
077    
078        public static byte parseByte(String lexicalXSDByte) {
079            return converter.parseByte(lexicalXSDByte);
080        }
081    
082        public static QName parseQName(String lexicalXSDQName, NamespaceContext nsc) {
083            return converter.parseQName(lexicalXSDQName, nsc);
084        }
085    
086        public static Calendar parseDateTime(String lexicalXSDDateTime) {
087            return converter.parseDateTime(lexicalXSDDateTime);
088        }
089    
090        public static byte[] parseBase64Binary(String lexicalXSDBase64Binary) {
091            return converter.parseBase64Binary(lexicalXSDBase64Binary);
092        }
093    
094        public static byte[] parseHexBinary(String lexicalXSDHexBinary) {
095            return converter.parseHexBinary(lexicalXSDHexBinary);
096        }
097    
098        public static long parseUnsignedInt(String lexicalXSDUnsignedInt) {
099            return converter.parseUnsignedInt(lexicalXSDUnsignedInt);
100        }
101    
102        public static int parseUnsignedShort(String lexicalXSDUnsignedShort) {
103            return converter.parseUnsignedShort(lexicalXSDUnsignedShort);
104        }
105    
106        public static Calendar parseTime(String lexicalXSDTime) {
107            return converter.parseTime(lexicalXSDTime);
108        }
109    
110        public static Calendar parseDate(String lexicalXSDDate) {
111            return converter.parseDate(lexicalXSDDate);
112        }
113    
114        public static String parseAnySimpleType(String lexicalXSDAnySimpleType) {
115            return converter.parseAnySimpleType(lexicalXSDAnySimpleType);
116        }
117    
118        public static String printString(String val) {
119            return converter.printString(val);
120        }
121    
122        public static String printInteger(BigInteger val) {
123            return converter.printInteger(val);
124        }
125    
126        public static String printInt(int val) {
127            return converter.printInt(val);
128        }
129    
130        public static String printLong(long val) {
131            return converter.printLong(val);
132        }
133    
134        public static String printShort(short val) {
135            return converter.printShort(val);
136        }
137    
138        public static String printDecimal(BigDecimal val) {
139            return converter.printDecimal(val);
140        }
141    
142        public static String printFloat(float val) {
143            return converter.printFloat(val);
144        }
145    
146        public static String printDouble(double val) {
147            return converter.printDouble(val);
148        }
149    
150        public static String printBoolean(boolean val) {
151            return converter.printBoolean(val);
152        }
153    
154        public static String printByte(byte val) {
155            return converter.printByte(val);
156        }
157    
158        public static String printQName(QName val, NamespaceContext nsc) {
159            return converter.printQName(val, nsc);
160        }
161    
162        public static String printDateTime(Calendar val) {
163            return converter.printDateTime(val);
164        }
165    
166        public static String printBase64Binary(byte val[]) {
167            return converter.printBase64Binary(val);
168        }
169    
170        public static String printHexBinary(byte val[]) {
171            return converter.printHexBinary(val);
172        }
173    
174        public static String printUnsignedInt(long val) {
175            return converter.printUnsignedInt(val);
176        }
177    
178        public static String printUnsignedShort(int val) {
179            return converter.printUnsignedShort(val);
180        }
181    
182        public static String printTime(Calendar val) {
183            return converter.printTime(val);
184        }
185    
186        public static String printDate(Calendar val) {
187            return converter.printDate(val);
188        }
189    
190        public static String printAnySimpleType(String val) {
191            return converter.printAnySimpleType(val);
192        }
193    
194    }