|
JSAPI 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectRuleComponent
RuleReference
public class RuleReference
Specifies a reference to a RuleGrammar
or a named Rule
in a RuleGrammar
.
The following table summarizes the various forms of rule reference in SRGS:
Local rule reference | <ruleref uri="#rulename"/> |
Reference to a named rule of a grammar identified by a URI with optional media type | <ruleref uri="grammarURI#rulename" type="media-type"/> |
Reference to the root rule of a grammar identified by a URI with optional media type | <ruleref uri="grammarURI" type="media-type"/> |
Rule names must match the "Name" Production of XML 1.0 [XML ยง2.3] and be a legal XML ID.
The RuleSpecial
class defines the special definitions
NULL
, VOID
, and GARBAGE
.
Grammar
,
RuleGrammar
,
RuleSpecial
,
NULL
,
VOID
,
GARBAGE
Constructor Summary | |
---|---|
RuleReference(String ruleName)
Constructs a RuleReference given a rule name. |
|
RuleReference(String grammarReference,
String ruleName)
Constructs a RuleReference given a grammar reference
and rule name. |
|
RuleReference(String grammarReference,
String ruleName,
String mediaType)
Constructs a RuleReference from a
grammar reference, rule name, and media type. |
Method Summary | |
---|---|
String |
getGrammarReference()
Gets the grammar reference part of this RuleReference . |
String |
getMediaType()
Gets the media type part of this RuleReference . |
String |
getRuleName()
Gets the rule name part of this RuleReference . |
String |
toString()
Returns a String representing this RuleComponent
as grammar text. |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RuleReference(String ruleName) throws IllegalArgumentException
RuleReference
given a rule name.
The rule name is local to the RuleGrammar
context used.
ruleName
- the name of a rule
IllegalArgumentException
- if ruleName
is not
valid grammar text or is null
getRuleName
public RuleReference(String grammarReference, String ruleName) throws IllegalArgumentException
RuleReference
given a grammar reference
and rule name.
The rule name is considered in the context of the grammar reference.
grammarReference
- the grammar reference for the desired grammarruleName
- the name of a rule
IllegalArgumentException
- if the arguments are not
valid grammar text or if both arguments are null
getGrammarReference
,
getRuleName
public RuleReference(String grammarReference, String ruleName, String mediaType) throws IllegalArgumentException
RuleReference
from a
grammar reference, rule name, and media type.
The rule name is considered in the context of the grammar reference.
The media type should match the media type of
the grammar being referenced.
If the media type is null
, the default media type is used.
The default media type is "application/srgs+xml"
.
grammarReference
- the grammar reference for the desired grammarruleName
- the name of a rulemediaType
- the media type of the containing grammar
IllegalArgumentException
- if the arguments are
not valid grammar text
or if grammarReference
and ruleName
are both null
getGrammarReference
,
getRuleName
,
getMediaType
Method Detail |
---|
public String getGrammarReference()
RuleReference
.
This can return null
if this is a local RuleReference
.
getRuleName
public String getRuleName()
RuleReference
.
This can return null
if this RuleReference
refers to the root rule
of the grammar reference.
getGrammarReference
public String getMediaType()
RuleReference
.
This returns null
if not specified in the constructor.
getGrammarReference
,
getRuleName
public String toString()
String
representing this RuleComponent
as grammar text.
The String
represents a portion of a grammar that could appear
on the right hand side of a Rule
definition.
toString
in class RuleComponent
String
representing grammar text.RuleComponent
,
Rule
|
JSAPI 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaTM Speech API 2.0,
Final Release v2.0.6.
© 2008, Conversay and Sun Microsystems.