com.sun.xml.bind
Class GrammarImpl

java.lang.Object
  extended by com.sun.xml.bind.GrammarImpl
All Implemented Interfaces:
java.io.Serializable

public class GrammarImpl
extends java.lang.Object
implements java.io.Serializable

Implementation of the Grammar interface with "plugs" that allows a grammar to be connected to other grammars when assembled through the context path.

These classes will be freeze-dried to "bgm.ser", so they must be serializable.

This class also implements a trick to allow a large grammar to be serialized without causing a stack overflow error. This is done by modifying the ElementExp#contentModel field to Expression#nullSet in the serialized form. The correct references will be restored after the grammar is deserialized.

Since:
1.0
See Also:
Serialized Form

Nested Class Summary
static class GrammarImpl.Plug
          Inter-grammar connection that needs be bound.
 
Constructor Summary
GrammarImpl(ExpressionPool pool)
           
 
Method Summary
 void connect(Grammar[] others)
          Connect this grammar to other grammars.
 ElementPattern createElement(NameClass nc, Expression contentModel)
          Creates a new ElementExp declaration inside this grammar.
 ExpressionPool getPool()
           
 Expression getTopLevel()
           
 void setPlugs(GrammarImpl.Plug[] plugs)
           
 void setTopLevel(Expression topLevel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrammarImpl

public GrammarImpl(ExpressionPool pool)
Method Detail

setPlugs

public void setPlugs(GrammarImpl.Plug[] plugs)

setTopLevel

public void setTopLevel(Expression topLevel)

getTopLevel

public Expression getTopLevel()

getPool

public ExpressionPool getPool()

connect

public void connect(Grammar[] others)
Connect this grammar to other grammars.


createElement

public ElementPattern createElement(NameClass nc,
                                    Expression contentModel)
Creates a new ElementExp declaration inside this grammar.

While the other ordinary ElementExps can be also used, this ElementExp allows the grammar to be serialized without too much recursion.