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 * Encapsulates various JAXB operations on objects bound by JAXB. 325N/A * Immutable and thread-safe. 325N/A * Each JAXB-bound class has a corresponding {@link JaxBeanInfo} object, 325N/A * which performs all the JAXB related operations on behalf of 325N/A * the JAXB-bound object. 325N/A * Given a class, the corresponding {@link JaxBeanInfo} can be located 325N/A * via {@link JAXBContextImpl#getBeanInfo(Class,boolean)}. 325N/A * Typically, {@link JaxBeanInfo} implementations should be generated 325N/A * by XJC/JXC. Those impl classes will register themselves to their 325N/A * master <tt>ObjectFactory</tt> class. 325N/A * The type parameter BeanT is the Java class of the bean that this represents. 325N/A * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) 325N/A * For {@link JaxBeanInfo} that has multiple type names. 325N/A * For {@link JaxBeanInfo} that has one type name. 325N/A * For {@link JaxBeanInfo} that has no type names. 325N/A * Various boolean flags combined into one field to improve memory footprint. 325N/A /** cache of lifecycle methods */ 325N/A * True if {@link #jaxbType} has the lifecycle method. 325N/A * True if {@link #jaxbType} has the lifecycle method. 325N/A * True if {@link #jaxbType} has the lifecycle method. 325N/A * True if {@link #jaxbType} has the lifecycle method. 325N/A * Gets the JAXB bound class type that this {@link JaxBeanInfo} 325N/A * IOW, when a bean info object is requested for T, 325N/A * sometimes the bean info for one of its base classes might be 325N/A * Returns true if the bean is mapped to/from an XML element. 325N/A * When this method returns true, {@link #getElementNamespaceURI(Object)} 325N/A * and {@link #getElementLocalName(Object)} returns the element name of 325N/A * Returns true if the bean is immutable. 325N/A * If this is true, Binder won't try to ueuse this object, and the unmarshaller 325N/A * won't create a new instance of it before it starts. 325N/A * True if this bean has an element-only content model. 325N/A * If this flag is true, the unmarshaller can work 325N/A * faster by ignoring whitespaces more efficiently. 325N/A * True if this bean has an element-only content model. 325N/A * Should be considered immutable, though I can't mark it final 325N/A * because it cannot be computed in this constructor. 325N/A * This method is used to determine which of the sub-classes should be 325N/A * interrogated for the existence of lifecycle methods. 325N/A * @return true if the un|marshaller should look for lifecycle methods 325N/A * on this beanInfo, false otherwise. 325N/A * Returns the namespace URI portion of the element name, 325N/A * if the bean that this class represents is mapped from/to 325N/A * @throws UnsupportedOperationException 325N/A * if {@link #isElement} is false. 325N/A * Returns the local name portion of the element name, 325N/A * if the bean that this class represents is mapped from/to 325N/A * @throws UnsupportedOperationException 325N/A * if {@link #isElement} is false. 325N/A * Type names associated with this {@link JaxBeanInfo}. 325N/A private final Object typeName;
// either null, QName, or QName[]. save memory since most of them have just one. 325N/A * Returns XML Schema type names if the bean is mapped from 325N/A * This is an ugly necessity to correctly handle 325N/A * the type substitution semantics of XML Schema. 325N/A * A single Java class maybe mapped to more than one 325N/A * XML types. All the types listed here are recognized 325N/A * when we are unmarshalling XML. 325N/A * null if the class is not bound to a named schema type. 325N/A * Returns the XML type name to be used to marshal the specified instance. 325N/A * Most of the times the type can be determined regardless of the actual 325N/A * instance, but there's a few exceptions (most notably {@link XMLGregorianCalendar}), 325N/A * so as a general rule we need an instance to determine it. 325N/A * Creates a new instance of the bean. 325N/A * This operation is only supported when {@link #isImmutable} is false. 325N/A * Sometimes the created bean remembers the corresponding source location, 325N/A * Resets the object to the initial state, as if the object 325N/A * This is used to reuse an existing object for unmarshalling. 325N/A * used for reporting any errors. 325N/A * true if the object was successfuly resetted. 325N/A * False if the object is not resettable, in which case the object will be 325N/A * discarded and new one will be created. 325N/A * If the object is resettable but failed by an error, it should be reported to the context, 325N/A * then return false. If the object is not resettable to begin with, do not report an error. 325N/A * as a result of reporting an error, the context may throw a {@link SAXException}. 325N/A * Gets the ID value of the given bean, if it has an ID value. 325N/A * Otherwise return null. 325N/A * Serializes child elements and texts into the specified target. 325N/A * Serializes attributes into the specified target. 325N/A * Serializes the bean as the root element. 325N/A * In the java-to-schema binding, an object might marshal in two different 325N/A * ways depending on whether it is used as the root of the graph or not. 325N/A * In the former case, an object could marshal as an element, whereas 325N/A * in the latter case, it marshals as a type. 325N/A * This method is used to marshal the root of the object graph to allow 325N/A * this semantics to be implemented. 325N/A * It is doubtful to me if it's a good idea for an object to marshal 325N/A * in two ways depending on the context. 325N/A * For schema-to-java, this is equivalent to {@link #serializeBody(Object, XMLSerializer)}. 325N/A * Declares all the namespace URIs this object is using at 325N/A * its top-level scope into the specified target. 325N/A * Gets the {@link Loader} that will unmarshall the given object. 325N/A * The {@link JAXBContextImpl} object that governs this object. 325N/A * This object is taken as a parameter so that {@link JaxBeanInfo} doesn't have 325N/A * to store them on its own. 325N/A * When this method is invoked from within the unmarshaller, tihs parameter can be 325N/A * null (because the loader is constructed already.) 325N/A * @param typeSubstitutionCapable 325N/A * If true, the returned {@link Loader} is capable of recognizing @xsi:type (if necessary) 325N/A * and unmarshals a subtype. This allowes an optimization where this bean info 325N/A * is guaranteed not to have a type substitution. 325N/A * If false, the returned {@link Loader} doesn't look for @xsi:type. 325N/A * must return non-null valid object 325N/A * If the bean's representation in XML is just a text, 325N/A * this method return a {@link Transducer} that lets you convert 325N/A * values between the text and the bean. 325N/A * Called after all the {@link JaxBeanInfo}s are created. 325N/A * Called at the end of the {@link JAXBContext} initialization phase 325N/A * to clean up any unnecessary references. 325N/A * use reflection to determine which of the 4 object lifecycle methods exist on 325N/A // this happens when we don't have enough permission. 325N/A * Cache a reference to the specified lifecycle method for the jaxbType 325N/A * associated with this beanInfo. 325N/A * @param m Method reference 325N/A * @param lifecycleFlag byte representing which of the 4 lifecycle methods 325N/A //LifecycleMethods lcm = getLifecycleMethods(); 325N/A //lcmCache.put(jaxbType, lcm); 325N/A * Return the LifecycleMethods cache for this ClassBeanInfo's corresponding 325N/A * jaxbType if it exists, else return null. 325N/A * Invokes the beforeUnmarshal method if applicable. 325N/A * Invokes the afterUnmarshal method if applicable.