325N/A * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 325N/A * This code is free software; you can redistribute it and/or modify it 325N/A * under the terms of the GNU General Public License version 2 only, as 325N/A * published by the Free Software Foundation. Oracle designates this 325N/A * particular file as subject to the "Classpath" exception as provided 325N/A * by Oracle in the LICENSE file that accompanied this code. 325N/A * This code is distributed in the hope that it will be useful, but WITHOUT 325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 325N/A * version 2 for more details (a copy is included in the LICENSE file that 325N/A * accompanied this code). 325N/A * You should have received a copy of the GNU General Public License version 325N/A * 2 along with this work; if not, write to the Free Software Foundation, 325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 325N/A * or visit www.oracle.com if you need additional information or have any 325N/A * Conversion declaration. 325N/A * A conversion declaration specifies how an XML type gets mapped 325N/A * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) 325N/A * Gets the {@link TypeUse} object that this conversion represents. 325N/A * The returned {@link TypeUse} object is properly adapted. 325N/A * A {@link BIConversion} is always associated with one 325N/A * {@link XSSimpleType}, but that's not always available 325N/A * when a {@link BIConversion} is built. So we pass this 325N/A * as a parameter to this method. 325N/A /** Name of the conversion declaration. */ 325N/A * Implementation that returns a statically-determined constant {@link TypeUse}. 325N/A * User-specified <javaType> customization. 325N/A * and their default values are determined based on the 325N/A * If null, computed from {@link #type}. 325N/A * Sometimes this can be set instead of {@link #type}. 325N/A * Cache used by {@link #getTypeUse(XSSimpleType)} to improve the performance. 325N/A // XmlJavaType customization always converts between string and an user-defined type. 325N/A * generate the adapter class. 325N/A // try another name in search for an unique name. 325N/A // this isn't too efficient, but we expect people to usually use 325N/A // a very small number of adapters. 325N/A // "new" indicates that the constructor of the target type 325N/A // will do the unmarshalling. 325N/A // RESULT: new <type>() 325N/A // parseMethod specifies the static method of the target type 325N/A // which will do the unmarshalling. 325N/A // because of an error check at the constructor, 325N/A // we can safely assume that this cast works. 325N/A // UGLY: if this conversion is the system-driven conversion, 325N/A // printMethod specifies a method in the target type 325N/A // which performs the serialization. 325N/A // RESULT: <value>.<method>() 325N/A // check value is not null ... if(value == null) return null; 325N/A // RESULT: <className>.<method>(<value>) 325N/A // this cast is necessary for conversion between primitive Java types 325N/A "Float",
"Double",
"Byte",
"Short",
"Int",
"Long",
"Boolean" 325N/A // find the base simple type mapping. 325N/A continue;
// user-defined type 325N/A /** Name of the conversion declaration. */ 325N/A a.
hide();
// we assume this is given by the user 325N/A // TODO: it's not correct to say that it adapts from String, 325N/A // but OTOH I don't think we can compute that.