< prev index next >

src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/Model.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -23,24 +23,10 @@
  * questions.
  */
 
 package com.sun.tools.internal.xjc.model;
 
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.namespace.QName;
-import javax.xml.transform.Result;
-
 import com.sun.codemodel.internal.JClass;
 import com.sun.codemodel.internal.JCodeModel;
 import com.sun.codemodel.internal.JPackage;
 import com.sun.tools.internal.xjc.ErrorReceiver;
 import com.sun.tools.internal.xjc.Options;

@@ -59,15 +45,27 @@
 import com.sun.xml.internal.bind.v2.model.core.TypeInfoSet;
 import com.sun.xml.internal.bind.v2.model.nav.Navigator;
 import com.sun.xml.internal.bind.v2.util.FlattenIterator;
 import com.sun.xml.internal.xsom.XSComponent;
 import com.sun.xml.internal.xsom.XSSchemaSet;
-
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.LocatorImpl;
 
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Result;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * Root of the object model that represents the code that needs to be generated.
  *
  * <p>
  * A {@link Model} is a schema language neutral representation of the

@@ -90,11 +88,11 @@
 
     /**
      * The element mappings.
      */
     private final Map<NClass/*scope*/,Map<QName,CElementInfo>> elementMappings =
-        new HashMap<NClass,Map<QName,CElementInfo>>();
+            new LinkedHashMap<NClass, Map<QName, CElementInfo>>();
 
     private final Iterable<? extends CElementInfo> allElements =
         new Iterable<CElementInfo>() {
             public Iterator<CElementInfo> iterator() {
                 return new FlattenIterator<CElementInfo>(elementMappings.values());

@@ -130,15 +128,15 @@
     /**
      * If this model was built from XML Schema, this field
      * stores the root object of the parse schema model.
      * Otherwise null.
      *
-     * @sine 2.1.1
+     * @since 2.1.1
      */
     public final XSSchemaSet schemaComponent;
 
-    private CCustomizations gloablCustomizations = new CCustomizations();
+    private CCustomizations globalCustomizations = new CCustomizations();
 
     /**
      * @param nc
      *      Usually this should be set in the constructor, but we do allow this parameter
      *      to be initially null, and then set later.

@@ -150,17 +148,17 @@
         this.codeModel = cm;
         this.nameConverter = nc;
         this.defaultSymbolSpace = new SymbolSpace(codeModel);
         defaultSymbolSpace.setType(codeModel.ref(Object.class));
 
-        elementMappings.put(null,new HashMap<QName,CElementInfo>());
+        elementMappings.put(null, new LinkedHashMap<QName, CElementInfo>());
 
         if(opts.automaticNameConflictResolution)
             allocator = new AutoClassNameAllocator(allocator);
         this.allocator = new ClassNameAllocatorWrapper(allocator);
         this.schemaComponent = schemaComponent;
-        this.gloablCustomizations.setParent(this,this);
+        this.globalCustomizations.setParent(this, this);
     }
 
     public void setNameConverter(NameConverter nameConverter) {
         assert this.nameConverter==null;
         assert nameConverter!=null;

@@ -318,11 +316,11 @@
      * This is used to support the use of a schema inside WSDL.
      * For XML Schema, the top-level binding is a map from
      * global element declarations to its representation class.
      *
      * <p>
-     * For other schema languages, it should follow the appendicies in
+     * For other schema languages, it should follow the appendices in
      * WSDL (but in practice no one would use WSDL with a schema language
      * other than XML Schema, so it doesn't really matter.)
      *
      * <p>
      * This needs to be filled by the front-end.

@@ -422,11 +420,11 @@
 
     /**
      * Gets the global customizations.
      */
     public CCustomizations getCustomizations() {
-        return gloablCustomizations;
+        return globalCustomizations;
     }
 
     /**
      * Not implemented in the compile-time model.
      */

@@ -464,11 +462,11 @@
         if(ei.getScope()!=null)
             clazz = ei.getScope().getClazz();
 
         Map<QName,CElementInfo> m = elementMappings.get(clazz);
         if(m==null)
-            elementMappings.put(clazz,m=new HashMap<QName,CElementInfo>());
+            elementMappings.put(clazz, m = new LinkedHashMap<QName, CElementInfo>());
         m.put(ei.getElementName(),ei);
     }
 
 
     private final Map<JPackage,CClassInfoParent.Package> cache = new HashMap<JPackage,CClassInfoParent.Package>();
< prev index next >