Top Description Inners Fields Constructors Methods
com.sun.tools.xjc.reader.xmlschema

public final Class ClassSelector

extends BindingComponent
Class Inheritance
Imports
java.io.StringWriter, java.util.HashMap, .HashSet, .Map, .Set, .Stack, com.sun.codemodel.JCodeModel, .JJavaName, .JPackage, com.sun.codemodel.util.Util, com.sun.istack.NotNull, com.sun.tools.xjc.model.CBuiltinLeafInfo, .CClassInfo, .CClassInfoParent, .CElement, .CElementInfo, .CTypeInfo, .TypeUse, .CClass, .CNonElement, com.sun.tools.xjc.reader.Ring, com.sun.tools.xjc.reader.xmlschema.bindinfo.BIProperty, .BISchemaBinding, .LocalScoping, com.sun.xml.xsom.XSComplexType, .XSComponent, .XSDeclaration, .XSElementDecl, .XSSchema, .XSSchemaSet, .XSSimpleType, .XSType, com.sun.xml.xsom.impl.util.SchemaWriter, com.sun.xml.xsom.util.ComponentNameFunction, org.xml.sax.Locator, javax.xml.XMLConstants

Manages association between XSComponents and generated CTypeInfos.

This class determines which component is mapped to (or is not mapped to) what types.

Author
Kohsuke Kawaguchi ([email protected])

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final Map<XSComponent, ClassSelector.Binding>
bindMap

Map from XSComponents to Bindings.

private final Stack<ClassSelector.Binding>
bindQueue

A list of Bindings object that needs to be built.

pack-priv final Map<XSComponent, CElementInfo>
boundElements

UGLY HACK.

private final BGMBuilder
builder

Center of owner classes.

private final Set<CClassInfo>
built

CClassInfos that are already built.

private static Set<String>
checkedPackageNames

Set of package names that are tested (set of Strings.) This set is used to avoid duplicating "incorrect package name" errors.

private final ClassBinder
classBinder

Object that determines components that are mapped to classes.

private final Stack<CClassInfoParent>
classScopes

CClassInfoParents that determines where a new class should be created.

private CClassInfo
currentBean

The bean representation we are binding right now.

private XSComponent
currentRoot

The component that is being bound to currentBean.

private static final String[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv CTypeInfo
_bindToClass(XSComponent sc, XSComponent
The component that refers to sc. This can be null, if figuring out the referer is too hard, in which case the error message might be less user friendly.
referer
,
boolean
if the binding of the body of the class cannot be defered and needs to be done immediately. If the flag is false, the binding of the body will be done later, to avoid cyclic binding problem.
cannotBeDelayed
)

The real meat of the "bindToType" code.

private void
addSchemaFragmentJavadoc(CClassInfo bean, XSComponent sc)

Copies a schema fragment into the javadoc of the generated class.

private void
public CTypeInfo
bindToType(XSComponent sc, XSComponent referer)

Checks if the given component is being mapped to a type.

public CElement
public CClass
bindToType(XSComplexType t, XSComponent referer, boolean cannotBeDelayed)

public TypeUse
public void
executeTasks()

Runs all the pending build tasks.

public CClassInfoParent
getClassScope()

Gets the current class scope.

public CClassInfo
public XSComponent
public JPackage
getPackage(String targetNamespace)

Gets the Java package to which classes from this namespace should go.

public CElement
isBound(XSElementDecl x, XSComponent referer)

Checks if the given component is bound to a class.

private boolean
needValueConstructor(XSComponent sc)

Determines if the given component needs to have a value constructor (a constructor that takes a parmater.) on ObjectFactory.

public void
public void
public void
Inherited from com.sun.tools.xjc.reader.xmlschema.BindingComponent:
getClassSelectorgetErrorReporter

Field Detail

bindMapback to summary
private final Map<XSComponent, ClassSelector.Binding> bindMap

Map from XSComponents to Bindings. Keeps track of all content interfaces that are already built or being built.

bindQueueback to summary
private final Stack<ClassSelector.Binding> bindQueue

A list of Bindings object that needs to be built.

boundElementsback to summary
pack-priv final Map<XSComponent, CElementInfo> boundElements

UGLY HACK.

To avoid cyclic dependency between binding elements and types, we need additional markers that tell which elements are definitely not bound to a class.

the cyclic dependency is as follows: elements need to bind its types first, because otherwise it can't determine T of JAXBElement<T>. OTOH, types need to know whether its parent is bound to a class to decide which class name to use.

builderback to summary
private final BGMBuilder builder

Center of owner classes.

builtback to summary
private final Set<CClassInfo> built

CClassInfos that are already built.

checkedPackageNamesback to summary
private static Set<String> checkedPackageNames

Set of package names that are tested (set of Strings.) This set is used to avoid duplicating "incorrect package name" errors.

classBinderback to summary
private final ClassBinder classBinder

Object that determines components that are mapped to classes.

classScopesback to summary
private final Stack<CClassInfoParent> classScopes

CClassInfoParents that determines where a new class should be created.

currentBeanback to summary
private CClassInfo currentBean

The bean representation we are binding right now.

currentRootback to summary
private XSComponent currentRoot

The component that is being bound to currentBean.

reservedClassNamesback to summary
private static final String[] reservedClassNames

Constructor Detail

ClassSelectorback to summary
public ClassSelector()

Method Detail

_bindToClassback to summary
pack-priv CTypeInfo _bindToClass(XSComponent sc, XSComponent referer, boolean cannotBeDelayed)

The real meat of the "bindToType" code.

Parameters
referer:XSComponent

The component that refers to sc. This can be null, if figuring out the referer is too hard, in which case the error message might be less user friendly.

cannotBeDelayed:boolean

if the binding of the body of the class cannot be defered and needs to be done immediately. If the flag is false, the binding of the body will be done later, to avoid cyclic binding problem.

addSchemaFragmentJavadocback to summary
private void addSchemaFragmentJavadoc(CClassInfo bean, XSComponent sc)

Copies a schema fragment into the javadoc of the generated class.

appendback to summary
private void append(CClassInfo bean, String doc)
bindToTypeback to summary
public CTypeInfo bindToType(XSComponent sc, XSComponent referer)

Checks if the given component is being mapped to a type. If so, build that type and return that object. If it is not being mapped to a type item, return null.

bindToTypeback to summary
public CElement bindToType(XSElementDecl e, XSComponent referer)
bindToTypeback to summary
public CClass bindToType(XSComplexType t, XSComponent referer, boolean cannotBeDelayed)
bindToTypeback to summary
public TypeUse bindToType(XSType t, XSComponent referer)
executeTasksback to summary
public void executeTasks()

Runs all the pending build tasks.

getClassScopeback to summary
public CClassInfoParent getClassScope()

Gets the current class scope.

getCurrentBeanback to summary
public CClassInfo getCurrentBean()
getCurrentRootback to summary
public XSComponent getCurrentRoot()
getPackageback to summary
public JPackage getPackage(String targetNamespace)

Gets the Java package to which classes from this namespace should go.

Usually, the getOuterClass method should be used to determine where to put a class.

isBoundback to summary
public CElement isBound(XSElementDecl x, XSComponent referer)

Checks if the given component is bound to a class.

needValueConstructorback to summary
private boolean needValueConstructor(XSComponent sc)

Determines if the given component needs to have a value constructor (a constructor that takes a parmater.) on ObjectFactory.

popClassScopeback to summary
public void popClassScope()
pushClassScopeback to summary
public void pushClassScope(CClassInfoParent clsFctry)
queueBuildback to summary
public void queueBuild(XSComponent sc, CElement bean)
com.sun.tools.xjc.reader.xmlschema back to summary

private final Class ClassSelector.Binding

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final CTypeInfo
private final XSComponent

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

beanback to summary
private final CTypeInfo bean
scback to summary
private final XSComponent sc

Constructor Detail

Bindingback to summary
public Binding(XSComponent sc, CTypeInfo bean)

Method Detail

buildback to summary
pack-priv void build()