< prev index next >

src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/xmlschema/BGMBuilder.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  59 import com.sun.xml.internal.bind.api.impl.NameConverter;
  60 import com.sun.xml.internal.bind.v2.util.XmlFactory;
  61 import com.sun.xml.internal.xsom.XSAnnotation;
  62 import com.sun.xml.internal.xsom.XSAttributeUse;
  63 import com.sun.xml.internal.xsom.XSComponent;
  64 import com.sun.xml.internal.xsom.XSDeclaration;
  65 import com.sun.xml.internal.xsom.XSParticle;
  66 import com.sun.xml.internal.xsom.XSSchema;
  67 import com.sun.xml.internal.xsom.XSSchemaSet;
  68 import com.sun.xml.internal.xsom.XSSimpleType;
  69 import com.sun.xml.internal.xsom.XSTerm;
  70 import com.sun.xml.internal.xsom.XSType;
  71 import com.sun.xml.internal.xsom.XSWildcard;
  72 import com.sun.xml.internal.xsom.util.XSFinder;
  73 
  74 import org.xml.sax.Locator;
  75 
  76 /**
  77  * Root of the XML Schema binder.
  78  *
  79  * <div><img src="doc-files/binding_chart.png"/></div>
  80  *
  81  * @author Kohsuke Kawaguchi
  82  */
  83 public class BGMBuilder extends BindingComponent {
  84 
  85     /**
  86      * Entry point.
  87      */
  88     public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
  89             ErrorReceiver _errorReceiver, Options opts ) {
  90         // set up a ring
  91         final Ring old = Ring.begin();
  92         try {
  93             ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);
  94 
  95             Ring.add(XSSchemaSet.class,_schemas);
  96             Ring.add(codeModel);
  97             Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
  98             Ring.add(model);
  99             Ring.add(ErrorReceiver.class,ef);


 244      * The empty global binding is set as the default, so that
 245      * there will be no need to test if the value is null.
 246      */
 247     private BIGlobalBinding globalBinding;
 248 
 249     /**
 250      * Gets the global bindings.
 251      */
 252     public @NotNull BIGlobalBinding getGlobalBinding() { return globalBinding; }
 253 
 254 
 255     private ParticleBinder particleBinder;
 256 
 257     /**
 258      * Gets the particle binder for this binding.
 259      */
 260     public @NotNull ParticleBinder getParticleBinder() { return particleBinder; }
 261 
 262 
 263     /**
 264      * Name converter that implements "XML->Java name conversion"
 265      * as specified in the spec.
 266      *
 267      * This object abstracts the detail that we use different name
 268      * conversion depending on the customization.
 269      *
 270      * <p>
 271      * This object should be used to perform any name conversion
 272      * needs, instead of the JJavaName class in CodeModel.
 273      */
 274     public NameConverter getNameConverter() { return model.getNameConverter(); }
 275 
 276     /** Fill-in the contents of each classes. */
 277     private void buildContents() {
 278         ClassSelector cs = getClassSelector();
 279         SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
 280 
 281         for( XSSchema s : Ring.get(XSSchemaSet.class).getSchemas() ) {
 282             BISchemaBinding sb = getBindInfo(s).get(BISchemaBinding.class);
 283 
 284             if(sb!=null && !sb.map) {


   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  59 import com.sun.xml.internal.bind.api.impl.NameConverter;
  60 import com.sun.xml.internal.bind.v2.util.XmlFactory;
  61 import com.sun.xml.internal.xsom.XSAnnotation;
  62 import com.sun.xml.internal.xsom.XSAttributeUse;
  63 import com.sun.xml.internal.xsom.XSComponent;
  64 import com.sun.xml.internal.xsom.XSDeclaration;
  65 import com.sun.xml.internal.xsom.XSParticle;
  66 import com.sun.xml.internal.xsom.XSSchema;
  67 import com.sun.xml.internal.xsom.XSSchemaSet;
  68 import com.sun.xml.internal.xsom.XSSimpleType;
  69 import com.sun.xml.internal.xsom.XSTerm;
  70 import com.sun.xml.internal.xsom.XSType;
  71 import com.sun.xml.internal.xsom.XSWildcard;
  72 import com.sun.xml.internal.xsom.util.XSFinder;
  73 
  74 import org.xml.sax.Locator;
  75 
  76 /**
  77  * Root of the XML Schema binder.
  78  *
  79  * <div><img src="doc-files/binding_chart.png" alt=""></div>
  80  *
  81  * @author Kohsuke Kawaguchi
  82  */
  83 public class BGMBuilder extends BindingComponent {
  84 
  85     /**
  86      * Entry point.
  87      */
  88     public static Model build( XSSchemaSet _schemas, JCodeModel codeModel,
  89             ErrorReceiver _errorReceiver, Options opts ) {
  90         // set up a ring
  91         final Ring old = Ring.begin();
  92         try {
  93             ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver);
  94 
  95             Ring.add(XSSchemaSet.class,_schemas);
  96             Ring.add(codeModel);
  97             Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas);
  98             Ring.add(model);
  99             Ring.add(ErrorReceiver.class,ef);


 244      * The empty global binding is set as the default, so that
 245      * there will be no need to test if the value is null.
 246      */
 247     private BIGlobalBinding globalBinding;
 248 
 249     /**
 250      * Gets the global bindings.
 251      */
 252     public @NotNull BIGlobalBinding getGlobalBinding() { return globalBinding; }
 253 
 254 
 255     private ParticleBinder particleBinder;
 256 
 257     /**
 258      * Gets the particle binder for this binding.
 259      */
 260     public @NotNull ParticleBinder getParticleBinder() { return particleBinder; }
 261 
 262 
 263     /**
 264      * Name converter that implements "{@code XML -> Java} name conversion"
 265      * as specified in the spec.
 266      *
 267      * This object abstracts the detail that we use different name
 268      * conversion depending on the customization.
 269      *
 270      * <p>
 271      * This object should be used to perform any name conversion
 272      * needs, instead of the JJavaName class in CodeModel.
 273      */
 274     public NameConverter getNameConverter() { return model.getNameConverter(); }
 275 
 276     /** Fill-in the contents of each classes. */
 277     private void buildContents() {
 278         ClassSelector cs = getClassSelector();
 279         SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
 280 
 281         for( XSSchema s : Ring.get(XSSchemaSet.class).getSchemas() ) {
 282             BISchemaBinding sb = getBindInfo(s).get(BISchemaBinding.class);
 283 
 284             if(sb!=null && !sb.map) {


< prev index next >