Index: main/java/org/exolab/castor/xml/MarshalFramework.java =================================================================== --- main/java/org/exolab/castor/xml/MarshalFramework.java (Revision 6897) +++ main/java/org/exolab/castor/xml/MarshalFramework.java (Arbeitskopie) @@ -51,6 +51,7 @@ import org.exolab.castor.mapping.MappingException; import org.exolab.castor.mapping.loader.CollectionHandlers; +import java.util.Iterator; import java.util.Vector; @@ -322,7 +323,7 @@ public static InheritanceMatch[] searchInheritance(String name, String namespace, XMLClassDescriptor classDesc, XMLClassDescriptorResolver cdResolver) throws MarshalException { - ClassDescriptorEnumeration cde = null; + Iterator classDescriptorIterator = null; try { //-- A little required logic for finding Not-Yet-Loaded @@ -346,7 +347,7 @@ //-- end Not-Yet-Loaded descriptor logic //-- resolve all by XML name + namespace URI - cde = cdResolver.resolveAllByXMLName(name, namespace, null); + classDescriptorIterator = cdResolver.resolveAllByXMLName(name, namespace, null); } catch(ResolverException rx) { Throwable actual = rx.getCause(); @@ -364,9 +365,9 @@ XMLFieldDescriptor[] descriptors = classDesc.getElementDescriptors(); XMLClassDescriptor cdInherited = null; - if (cde.hasNext()) { - while (cde.hasNext() && (descriptor == null)) { - cdInherited = cde.getNext(); + if (classDescriptorIterator.hasNext()) { + while (classDescriptorIterator.hasNext() && (descriptor == null)) { + cdInherited = (XMLClassDescriptor) classDescriptorIterator.next(); Class subclass = cdInherited.getJavaClass(); for (int i = 0; i < descriptors.length; i++) { Index: main/java/org/exolab/castor/xml/ClassDescriptorEnumeration.java =================================================================== --- main/java/org/exolab/castor/xml/ClassDescriptorEnumeration.java (Revision 6897) +++ main/java/org/exolab/castor/xml/ClassDescriptorEnumeration.java (Arbeitskopie) @@ -1,74 +0,0 @@ -/** - * Redistribution and use of this software and associated documentation - * ("Software"), with or without modification, are permitted provided - * that the following conditions are met: - * - * 1. Redistributions of source code must retain copyright - * statements and notices. Redistributions must also contain a - * copy of this document. - * - * 2. Redistributions in binary form must reproduce the - * above copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * 3. The name "Exolab" must not be used to endorse or promote - * products derived from this Software without prior written - * permission of Intalio, Inc. For written permission, - * please contact info@exolab.org. - * - * 4. Products derived from this Software may not be called "Exolab" - * nor may "Exolab" appear in their names without prior written - * permission of Intalio, Inc. Exolab is a registered - * trademark of Intalio, Inc. - * - * 5. Due credit should be given to the Exolab Project - * (http://www.exolab.org/). - * - * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Copyright 2001 (C) Intalio, Inc. All Rights Reserved. - * - * $Id$ - */ - - -package org.exolab.castor.xml; - -/** - * An enumeration interface specifically for XMLClassDescriptors. - * - * @author Keith Visco - * @version $Revision$ $Date: 2003-03-03 00:05:44 -0700 (Mon, 03 Mar 2003) $ -**/ -public interface ClassDescriptorEnumeration { - - /** - * Returns true if there are more XMLClassDescriptors - * available. - * - * @return true if more XMLClassDescriptors exist within this - * enumeration. - **/ - public boolean hasNext(); - - /** - * Returns the next XMLClassDescriptor in this enumeration. - * - * @return the next XMLClassDescriptor in this enumeration. - **/ - public XMLClassDescriptor getNext(); - - -} //-- ClassDescriptorEnumeration Index: main/java/org/exolab/castor/xml/Marshaller.java =================================================================== --- main/java/org/exolab/castor/xml/Marshaller.java (Revision 6897) +++ main/java/org/exolab/castor/xml/Marshaller.java (Arbeitskopie) @@ -88,6 +88,7 @@ import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Enumeration; +import java.util.Iterator; import java.util.List; import java.util.Stack; @@ -1180,9 +1181,9 @@ if ((xmlElementName != null) && (xmlElementNameClassDesc != null)) { // More than one class can map to a given element name try { - ClassDescriptorEnumeration cdEnum = _cdResolver.resolveAllByXMLName(xmlElementName, null, null); - for (; cdEnum.hasNext();) { - xmlElementNameClassDesc = cdEnum.getNext(); + Iterator classDescriptorIter = _cdResolver.resolveAllByXMLName(xmlElementName, null, null); + for (; classDescriptorIter.hasNext();) { + xmlElementNameClassDesc = (XMLClassDescriptor) classDescriptorIter.next(); if (_class == xmlElementNameClassDesc.getJavaClass()) break; //reset the classDescriptor --> none has been found Index: main/java/org/exolab/castor/xml/util/XMLClassDescriptorResolverImpl.java =================================================================== --- main/java/org/exolab/castor/xml/util/XMLClassDescriptorResolverImpl.java (Revision 6898) +++ main/java/org/exolab/castor/xml/util/XMLClassDescriptorResolverImpl.java (Arbeitskopie) @@ -66,7 +66,6 @@ import org.exolab.castor.mapping.MappingLoader; import org.exolab.castor.util.LocalConfiguration; import org.exolab.castor.util.Configuration.Property; -import org.exolab.castor.xml.ClassDescriptorEnumeration; import org.exolab.castor.xml.Introspector; import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.ResolverException; @@ -282,14 +281,14 @@ * * @see org.exolab.castor.xml.XMLClassDescriptorResolver#resolveAllByXMLName(java.lang.String, java.lang.String, java.lang.ClassLoader) */ - public ClassDescriptorEnumeration resolveAllByXMLName(String xmlName, String namespaceURI, ClassLoader loader) { + public Iterator resolveAllByXMLName(String xmlName, String namespaceURI, ClassLoader loader) { if (xmlName == null || xmlName.length() == 0) { String error = "Cannot resolve a null or zero-length xml name."; throw new IllegalArgumentException(error); } // get all descriptors with the correct xml name - return new XCDEnumerator(_descriptorCache.getDescriptors(xmlName)); + return _descriptorCache.getDescriptors(xmlName); } //-- resolveAllByXMLName @@ -1021,39 +1053,4 @@ } } - /** - * A locally used implementation of ClassDescriptorEnumeration - */ - static class XCDEnumerator implements ClassDescriptorEnumeration { - - private final Iterator _descriptors; - - /** - * Creates an XCDEnumerator - */ - XCDEnumerator(Iterator descriptors) { - super(); - - _descriptors = descriptors; - } - - /** - * {@inheritDoc} - * - * @see org.exolab.castor.xml.ClassDescriptorEnumeration#getNext() - */ - public XMLClassDescriptor getNext() { - return (XMLClassDescriptor) _descriptors.next(); - } - - /** - * {@inheritDoc} - * - * @see org.exolab.castor.xml.ClassDescriptorEnumeration#hasNext() - */ - public boolean hasNext() { - return _descriptors.hasNext(); - } - } //-- ClassDescriptorEnumeration - } // -- ClassDescriptorResolverImpl