src/share/jaxws_classes/javax/xml/bind/DatatypeConverter.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  77  * print and parse functionality.
  78  * </p>
  79  *
  80  * <p>
  81  * A print method for a XML schema datatype can output any lexical
  82  * representation that is valid with respect to the XML schema datatype.
  83  * If an error is encountered during conversion, then an IllegalArgumentException,
  84  * or a subclass of IllegalArgumentException must be thrown by the method.
  85  * </p>
  86  *
  87  * @author <ul><li>Sekhar Vajjhala, Sun Microsystems, Inc.</li><li>Joe Fialli, Sun Microsystems Inc.</li><li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li><li>Ryan Shoemaker,Sun Microsystems Inc.</li></ul>
  88  * @see DatatypeConverterInterface
  89  * @see ParseConversionEvent
  90  * @see PrintConversionEvent
  91  * @since JAXB1.0
  92  */
  93 
  94 final public class DatatypeConverter {
  95 
  96     // delegate to this instance of DatatypeConverter
  97     private static DatatypeConverterInterface theConverter = null;
  98 
  99     private final static JAXBPermission SET_DATATYPE_CONVERTER_PERMISSION =
 100                            new JAXBPermission("setDatatypeConverter");
 101 
 102     private DatatypeConverter() {
 103         // private constructor
 104     }
 105 
 106     /**
 107      * This method is for JAXB provider use only.
 108      * <p>
 109      * JAXB Providers are required to call this method at some point before
 110      * allowing any of the JAXB client marshal or unmarshal operations to
 111      * occur.  This is necessary to configure the datatype converter that
 112      * should be used to perform the print and parse conversions.
 113      *
 114      * <p>
 115      * Calling this api repeatedly will have no effect - the
 116      * DatatypeConverterInterface instance passed into the first invocation is
 117      * the one that will be used from then on.


   1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  77  * print and parse functionality.
  78  * </p>
  79  *
  80  * <p>
  81  * A print method for a XML schema datatype can output any lexical
  82  * representation that is valid with respect to the XML schema datatype.
  83  * If an error is encountered during conversion, then an IllegalArgumentException,
  84  * or a subclass of IllegalArgumentException must be thrown by the method.
  85  * </p>
  86  *
  87  * @author <ul><li>Sekhar Vajjhala, Sun Microsystems, Inc.</li><li>Joe Fialli, Sun Microsystems Inc.</li><li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li><li>Ryan Shoemaker,Sun Microsystems Inc.</li></ul>
  88  * @see DatatypeConverterInterface
  89  * @see ParseConversionEvent
  90  * @see PrintConversionEvent
  91  * @since JAXB1.0
  92  */
  93 
  94 final public class DatatypeConverter {
  95 
  96     // delegate to this instance of DatatypeConverter
  97     private static volatile DatatypeConverterInterface theConverter = null;
  98 
  99     private final static JAXBPermission SET_DATATYPE_CONVERTER_PERMISSION =
 100                            new JAXBPermission("setDatatypeConverter");
 101 
 102     private DatatypeConverter() {
 103         // private constructor
 104     }
 105 
 106     /**
 107      * This method is for JAXB provider use only.
 108      * <p>
 109      * JAXB Providers are required to call this method at some point before
 110      * allowing any of the JAXB client marshal or unmarshal operations to
 111      * occur.  This is necessary to configure the datatype converter that
 112      * should be used to perform the print and parse conversions.
 113      *
 114      * <p>
 115      * Calling this api repeatedly will have no effect - the
 116      * DatatypeConverterInterface instance passed into the first invocation is
 117      * the one that will be used from then on.