com.sun.xml.bind.v2.schemagen
Class Tree

java.lang.Object
  extended by com.sun.xml.bind.v2.schemagen.Tree
Direct Known Subclasses:
Tree.Term

abstract class Tree
extends Object

Normalized representation of the content model.

This is built from bottom up so that we can eliminate redundant constructs, and produce the most concise content model definition in XML.


Nested Class Summary
(package private) static class Tree.Term
          Represents a terminal tree node, such as element, wildcard, etc.
 
Constructor Summary
Tree()
           
 
Method Summary
(package private)  boolean canBeTopLevel()
          Returns true if the top node of this tree can appear as a valid top-level content model in XML Schema.
(package private) abstract  boolean isNullable()
          Returns true if this tree accepts empty sequence.
(package private) static Tree makeGroup(GroupKind kind, List<Tree> children)
          Returns a group tree.
(package private)  Tree makeOptional(boolean really)
          Returns "T?" from "T".
(package private)  Tree makeRepeated(boolean really)
          Returns "T+" from "T".
protected abstract  void write(ContentModelContainer parent, boolean isOptional, boolean repeated)
          Writes out the content model.
protected  void write(com.sun.xml.bind.v2.schemagen.xmlschema.TypeDefParticle ct)
          Writes inside the given complex type.
protected  void writeOccurs(com.sun.xml.bind.v2.schemagen.xmlschema.Occurs o, boolean isOptional, boolean repeated)
          Convenience method to write occurrence constraints.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tree

Tree()
Method Detail

makeOptional

Tree makeOptional(boolean really)
Returns "T?" from "T".

Parameters:
really - if false this method becomes no-op. This is so that we can write the caller fluently.

makeRepeated

Tree makeRepeated(boolean really)
Returns "T+" from "T".

Parameters:
really - if false this method becomes no-op. This is so that we can write the caller fluently.

makeGroup

static Tree makeGroup(GroupKind kind,
                      List<Tree> children)
Returns a group tree.


isNullable

abstract boolean isNullable()
Returns true if this tree accepts empty sequence.


canBeTopLevel

boolean canBeTopLevel()
Returns true if the top node of this tree can appear as a valid top-level content model in XML Schema.

Model groups and occurrences that have model group in it can.


write

protected abstract void write(ContentModelContainer parent,
                              boolean isOptional,
                              boolean repeated)
Writes out the content model. Normall this runs recursively until we write out the whole content model.


write

protected void write(com.sun.xml.bind.v2.schemagen.xmlschema.TypeDefParticle ct)
Writes inside the given complex type.


writeOccurs

protected final void writeOccurs(com.sun.xml.bind.v2.schemagen.xmlschema.Occurs o,
                                 boolean isOptional,
                                 boolean repeated)
Convenience method to write occurrence constraints.