public class GrammarImpl extends Object implements com.sun.msv.grammar.Grammar, Serializable
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
GrammarImpl.Plug
Inter-grammar connection that needs be bound.
|
| Constructor and Description |
|---|
GrammarImpl(com.sun.msv.grammar.ExpressionPool pool) |
| Modifier and Type | Method and Description |
|---|---|
void |
connect(com.sun.msv.grammar.Grammar[] others)
Connect this grammar to other grammars.
|
com.sun.msv.grammar.trex.ElementPattern |
createElement(com.sun.msv.grammar.NameClass nc,
com.sun.msv.grammar.Expression contentModel)
Creates a new
ElementExp declaration inside this grammar. |
com.sun.msv.grammar.ExpressionPool |
getPool() |
com.sun.msv.grammar.Expression |
getTopLevel() |
void |
setPlugs(GrammarImpl.Plug[] plugs) |
void |
setTopLevel(com.sun.msv.grammar.Expression topLevel) |
public void setPlugs(GrammarImpl.Plug[] plugs)
public void setTopLevel(com.sun.msv.grammar.Expression topLevel)
public com.sun.msv.grammar.Expression getTopLevel()
getTopLevel in interface com.sun.msv.grammar.Grammarpublic com.sun.msv.grammar.ExpressionPool getPool()
getPool in interface com.sun.msv.grammar.Grammarpublic void connect(com.sun.msv.grammar.Grammar[] others)
public com.sun.msv.grammar.trex.ElementPattern createElement(com.sun.msv.grammar.NameClass nc,
com.sun.msv.grammar.Expression contentModel)
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.
Copyright © 2015 Oracle Corporation. All Rights Reserved.