com.sun.tools.xjc.reader.xmlschema
Class ClassSelector

java.lang.Object
  extended by com.sun.tools.xjc.reader.xmlschema.BindingComponent
      extended by com.sun.tools.xjc.reader.xmlschema.ClassSelector

public final class ClassSelector
extends BindingComponent

Manages association between XSComponents and generated content interfaces.

All the content interfaces are created, registered, and maintained in this class.


Field Summary
(package private)  java.util.Map<com.sun.xml.xsom.XSComponent,CElementInfo> boundElements
          UGLY HACK.
 
Constructor Summary
ClassSelector()
           
 
Method Summary
(package private)  CTypeInfo _bindToClass(com.sun.xml.xsom.XSComponent sc, boolean cannotBeDelayed)
           
 CClassInfo bindToType(com.sun.xml.xsom.XSComplexType t)
           
 CClassInfo bindToType(com.sun.xml.xsom.XSComplexType t, boolean cannotBeDelayed)
           
 CTypeInfo bindToType(com.sun.xml.xsom.XSComponent sc)
          Checks if the given component is being mapped to a type.
 CElement bindToType(com.sun.xml.xsom.XSElementDecl e)
           
 TypeUse bindToType(com.sun.xml.xsom.XSType t)
           
 void executeTasks()
          Runs all the pending build tasks.
 CClassInfoParent getClassScope()
          Gets the current class scope.
 CClassInfo getCurrentBean()
           
 com.sun.xml.xsom.XSComponent getCurrentRoot()
           
 com.sun.codemodel.JPackage getPackage(java.lang.String targetNamespace)
          Gets the Java package to which classes from this namespace should go.
 CElement isBound(com.sun.xml.xsom.XSElementDecl x)
          Checks if the given component is bound to a class.
 void popClassScope()
           
 void pushClassScope(CClassInfoParent clsFctry)
           
 void queueBuild(com.sun.xml.xsom.XSComponent sc, CElement bean)
           
 
Methods inherited from class com.sun.tools.xjc.reader.xmlschema.BindingComponent
getClassSelector, getErrorReporter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

boundElements

final java.util.Map<com.sun.xml.xsom.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

getClassScope

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


pushClassScope

public final void pushClassScope(CClassInfoParent clsFctry)

popClassScope

public final void popClassScope()

getCurrentRoot

public com.sun.xml.xsom.XSComponent getCurrentRoot()

getCurrentBean

public CClassInfo getCurrentBean()

isBound

public final CElement isBound(com.sun.xml.xsom.XSElementDecl x)
Checks if the given component is bound to a class.


bindToType

public CTypeInfo bindToType(com.sun.xml.xsom.XSComponent sc)
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(com.sun.xml.xsom.XSElementDecl e)

bindToType

public CClassInfo bindToType(com.sun.xml.xsom.XSComplexType t)

bindToType

public CClassInfo bindToType(com.sun.xml.xsom.XSComplexType t,
                             boolean cannotBeDelayed)

bindToType

public TypeUse bindToType(com.sun.xml.xsom.XSType t)

_bindToClass

CTypeInfo _bindToClass(com.sun.xml.xsom.XSComponent sc,
                       boolean cannotBeDelayed)
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.

executeTasks

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


queueBuild

public void queueBuild(com.sun.xml.xsom.XSComponent sc,
                       CElement bean)

getPackage

public com.sun.codemodel.JPackage getPackage(java.lang.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.