com.sun.tools.xjc.reader.xmlschema

Class ClassSelector

public final class ClassSelector extends BindingComponent

Manages association between XSComponents and generated CTypeInfos.

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

Field Summary
Map<XSComponent,CElementInfo>boundElements
UGLY HACK.
Constructor Summary
ClassSelector()
Method Summary
CTypeInfobindToType(XSComponent sc, XSComponent referer)
Checks if the given component is being mapped to a type.
CElementbindToType(XSElementDecl e, XSComponent referer)
CClassbindToType(XSComplexType t, XSComponent referer, boolean cannotBeDelayed)
TypeUsebindToType(XSType t, XSComponent referer)
voidexecuteTasks()
Runs all the pending build tasks.
CClassInfoParentgetClassScope()
Gets the current class scope.
CClassInfogetCurrentBean()
XSComponentgetCurrentRoot()
JPackagegetPackage(String targetNamespace)
Gets the Java package to which classes from this namespace should go.
CElementisBound(XSElementDecl x, XSComponent referer)
Checks if the given component is bound to a class.
voidpopClassScope()
voidpushClassScope(CClassInfoParent clsFctry)
voidqueueBuild(XSComponent sc, CElement bean)
CTypeInfo_bindToClass(XSComponent sc, XSComponent referer, boolean cannotBeDelayed)
The real meat of the "bindToType" code.

Field Detail

boundElements

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. OTOH, types need to know whether its parent is bound to a class to decide which class name to use.

Constructor Detail

ClassSelector

public ClassSelector()

Method Detail

bindToType

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.

bindToType

public CElement bindToType(XSElementDecl e, XSComponent referer)

bindToType

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

bindToType

public TypeUse bindToType(XSType t, XSComponent referer)

executeTasks

public void executeTasks()
Runs all the pending build tasks.

getClassScope

public final CClassInfoParent getClassScope()
Gets the current class scope.

getCurrentBean

public CClassInfo getCurrentBean()

getCurrentRoot

public XSComponent getCurrentRoot()

getPackage

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.

isBound

public final CElement isBound(XSElementDecl x, XSComponent referer)
Checks if the given component is bound to a class.

popClassScope

public final void popClassScope()

pushClassScope

public final void pushClassScope(CClassInfoParent clsFctry)

queueBuild

public void queueBuild(XSComponent sc, CElement bean)

_bindToClass

CTypeInfo _bindToClass(XSComponent sc, XSComponent referer, boolean cannotBeDelayed)
The real meat of the "bindToType" code.

Parameters: cannotBeDelayed 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. referer 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.