/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Root of the XML Schema binder.
*
* <div><img src="doc-files/binding_chart.png"/></div>
*
* @author Kohsuke Kawaguchi
*/
/**
* Entry point.
*/
// set up a ring
try {
else return model;
} finally {
}
}
/**
* True if the compiler is running in the extension mode
* (as opposed to the strict conformance mode.)
*/
public final boolean inExtensionMode;
/**
* If this is non-null, this package name takes over
* all the schema customizations.
*/
/**
* If this is non-null, this package name will be
* used when no customization is specified.
*/
/**
* Lazily computed {@link RefererFinder}.
*
* @see #getReferer
*/
this.inExtensionMode = _inExtensionMode;
this.defaultPackage1 = defaultPackage1;
this.defaultPackage2 = defaultPackage2;
this.activePlugins = activePlugins;
}
private void _build() {
// do the binding
// additional error check
// Reports unused customizations to the user as errors.
}
/** List up all the global bindings. */
private void promoteGlobalBindings() {
// promote any global bindings in the schema
// collect all global customizations
continue;
if(globalBinding==null) {
globalBinding = gb;
} else {
if (!globalBinding.isEqual(gb)) { // see Issue 687 - this may happen with syntactically imported documents
// acknowledge this customization and report an error
// otherwise the user will see "customization is attached to a wrong place" error,
// which is incorrect
}
}
}
if( globalBinding==null ) {
// no global customization is present.
// use the default one
globalBinding = new BIGlobalBinding();
}
// code generation mode
particleBinder = globalBinding.isSimpleMode() ? new ExpressionParticleBinder() : new DefaultParticleBinder();
// check XJC extensions and realize them
model.serializable = true;
}
// obtain the name conversion mode
// attach global conversions to the appropriate simple types
}
/**
* Global bindings.
*
* The empty global binding is set as the default, so that
* there will be no need to test if the value is null.
*/
/**
* Gets the global bindings.
*/
/**
* Gets the particle binder for this binding.
*/
/**
* Name converter that implements "XML->Java name conversion"
* as specified in the spec.
*
* This object abstracts the detail that we use different name
* conversion depending on the customization.
*
* <p>
* This object should be used to perform any name conversion
* needs, instead of the JJavaName class in CodeModel.
*/
/** Fill-in the contents of each classes. */
private void buildContents() {
continue; // no mapping for this package
}
populate(s.getAttGroupDecls(),s);
populate(s.getAttributeDecls(),s);
populate(s.getElementDecls(),s);
populate(s.getModelGroupDecls(),s);
// fill in typeUses
}
}
}
/** Reports an error if there are more than one jaxb:schemaBindings customization. */
}
// error
schema.getTargetNamespace() );
}
/**
* Calls {@link ClassSelector} for each item in the iterator
* to populate class items if there is any.
*/
}
/**
* Generates <code>package.html</code> if the customization
* says so.
*/
// look for the schema-wide customization
// produce a HTML file
}
/**
* Gets or creates the BindInfo object associated to a schema component.
*
* @return
* Always return a non-null valid BindInfo object.
* Even if no declaration was specified, this method creates
* a new BindInfo so that new decls can be added.
*/
// XSOM is read-only, so we cannot add new annotations.
// for components that didn't have annotations,
// we maintain an external map.
return bi;
}
/**
* Used as a constant instance to represent the empty {@link BindInfo}.
*/
/**
* Gets the BindInfo object associated to a schema component.
*
* @return
* always return a valid {@link BindInfo} object. If none
* is specified for the given component, a dummy empty BindInfo
* will be returned.
*/
else return emptyBindInfo;
}
/**
* Gets the BindInfo object associated to a schema component.
*
* @return
* null if no bind info is associated to this schema component.
*/
return bi;
}
}
return null;
}
/**
* A map that stores binding declarations augmented by XJC.
*/
/**
* Gets the {@link BIDom} object that applies to the given particle.
*/
if (p == null) {
return null;
}
// if not, the term might have one.
// type could also have one, in case of the dom customization
if(t.isElementDecl())
// similarly the model group in a model group definition may have one.
if(t.isModelGroupDecl())
return null;
}
/**
* Returns true if the component should be processed by purple.
*/
// attribute use always maps to a property
return true;
}
// simple type always maps to a type, hence we should take purple
return true;
}
// attribute wildcards always maps to a property.
// element wildcards should have been processed with particle binders
return true;
}
};
/**
* If the component maps to a property, forwards to purple, otherwise to green.
*
* If the component is mapped to a type, this method needs to return true.
* See the chart at the class javadoc.
*/
else
}
/**
* Gets the shared instance of the identity transformer.
*/
try {
if(identityTransformer==null)
return identityTransformer;
} catch (TransformerConfigurationException e) {
throw new Error(e); // impossible
}
}
/**
* Find all types that refer to the given complex type.
*/
refFinder = new RefererFinder();
}
return refFinder.getReferer(c);
}
/**
* Returns the QName of the declaration.
* @return null
* if the declaration is anonymous.
*/
}
/**
* Derives a name from a schema component.
*
* XML-to-Java name conversion.
*
* @param name
* The base name. This should be things like element names
* or type names.
* @param comp
* The component from which the base name was taken.
* Used to determine how names are modified.
*/
}
return name;
}
public boolean isGenerateMixedExtensions() {
if (globalBinding != null) {
return globalBinding.isGenerateMixedExtensions();
}
return false;
}
}