com.sun.xml.bind.v2.schemagen

Class Tree

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
abstract static classTree.Term
Represents a terminal tree node, such as element, wildcard, etc.
Method Summary
booleancanBeTopLevel()
Returns true if the top node of this tree can appear as a valid top-level content model in XML Schema.
abstract booleanisNullable()
Returns true if this tree accepts empty sequence.
static TreemakeGroup(GroupKind kind, List<Tree> children)
Returns a group tree.
TreemakeOptional(boolean really)
Returns "T?
TreemakeRepeated(boolean really)
Returns "T+" from "T".
protected abstract voidwrite(ContentModelContainer parent, boolean isOptional, boolean repeated)
Writes out the content model.
protected voidwrite(TypeDefParticle ct)
Writes inside the given complex type.
protected voidwriteOccurs(Occurs o, boolean isOptional, boolean repeated)
Convenience method to write occurrence constraints.

Method Detail

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.

isNullable

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

makeGroup

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

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.

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(TypeDefParticle ct)
Writes inside the given complex type.

writeOccurs

protected final void writeOccurs(Occurs o, boolean isOptional, boolean repeated)
Convenience method to write occurrence constraints.