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 * Default classBinder implementation. Honors <jaxb:class> customizations 325N/A * and default bindings. 325N/A // no customization is given -- do as the default binding. 325N/A // in the simple mode, we may optimize it away 325N/A // if a global element contains 325N/A // a collpsable complex type, we bind this element to a named one 325N/A // and collapses element and complex type. 325N/A // by default, global ones get their own classes. 325N/A // the parent element was bound to a class. Don't bind this again to 325N/A // cause unnecessary wrapping 325N/A // generate one class from element and complex type together. 325N/A // this needs to be done before selector.isBound to avoid infinite recursion. 325N/A // but avoid doing so when the element is mapped to a class, 325N/A // which creates unnecessary classes 325N/A // special case where we put a nested 'Type' element 325N/A // since the parent element isn't bound to a type, merge the customizations associated to it, too. 325N/A// custs = CCustomizations.merge( custs, builder.getBindInfo(type.getScope()).toCustomizationList()); 325N/A * Returns true if the complex type of the given element can be "optimized away" 325N/A * and unified with its parent element decl to form a single class. 325N/A return false;
// not a complex type 325N/A // because element substitution calls for a proper JAXBElement hierarchy 325N/A // because nillable needs JAXBElement to represent correctly 325N/A // this customization forces non-collapsing behavior. 325N/A // in the simple mode, we do more aggressive optimization, and get rid of 325N/A // a complex type class if it's only used once from a global element 325N/A * If only one global {@link XSElementDecl} is refering to {@link XSType}, 325N/A * return that element, otherwise null. 325N/A // local element references can be ignored, as their names are either given 325N/A // by the property, or by the JAXBElement (for things like mixed contents) 325N/A // if another type refers to this type, that means 325N/A // this type has a sub-type, so type substitution is possible now. 325N/A // we want the returned type to be built as a complex type, 325N/A // so the binding cannot be delayed. 325N/A // otherwise map global elements to JAXBElement 325N/A // have the substitution member derive from the substitution head 325N/A // these methods won't be used 325N/A * Makes sure that the component doesn't carry a {@link BIClass} 325N/A * return value is unused. Since most of the caller needs to 325N/A * return null, to make the code a little bit shorter, this 325N/A * method always return null (so that the caller can always 325N/A * say <code>return never(sc);</code>. 325N/A // all we need to do here is just not to acknowledge 325N/A // any class customization. Then this class customization 325N/A // will be reported as an error later when we check all 325N/A // unacknowledged customizations. 325N/A// BIDeclaration cust=owner.getBindInfo(component).get(BIClass.NAME); 325N/A// owner.errorReporter.error( 325N/A// "test {0}", NameGetter.get(component) ); 325N/A * Checks if a component carries a customization to map it to a class. 325N/A * If so, make it a class. 325N/A * @param defaultBaseName 325N/A * The token which will be used as the basis of the class name 325N/A * if the class name is not specified in the customization. 325N/A * This is usually the name of an element declaration, and so on. 325N/A * This parameter can be null, in that case it would be an error 325N/A * if a name is not given by the customization. 325N/A // use this as biclass for current component 325N/A // first consider binding to the class reference. 325N/A // recover by ignoring @ref 325N/A // since we are not going to bind this complex type, we need to figure out 325N/A // its binding mode without actually binding it (and also expose this otherwise 325N/A // hidden mechanism into this part of the code.) 325N/A // this code is potentially dangerous as the base class might have been bound 325N/A // in different ways. To be correct, we need to figure out how the content type 325N/A // would have been bound, from the schema. 325N/A // if the customiztion doesn't give us a name, derive one 325N/A // from the current component. 325N/A // recover by generating a pseudo-random name 325N/A // not a valid Java class name 325N/A // recover by a dummy name 325N/A // TODO: support javadoc and userSpecifiedImplClass 325N/A // set javadoc class comment. 325N/A // add extra blank lines so that the schema fragment 325N/A // and user-specified javadoc would be separated 325N/A // if the implClass is given, set it to ClassItem 325N/A * Derives a name from a schema component. 325N/A * Use the name of the schema component as the default name. 325N/A * Derives a name from a schema component. 325N/A * For complex types, we take redefinition into account when 325N/A * deriving a default name.