Class SchemaBuilderImpl
java.lang.Object
com.sun.tools.txw2.builder.relaxng.SchemaBuilderImpl
- All Implemented Interfaces:
SchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl>
public final class SchemaBuilderImpl
extends Object
implements SchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl>
Builds a model from a RELAX NG grammar.
- Author:
- Kohsuke Kawaguchi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCalled when annotation is found right inside a pattern such as,annotateAfter
(Leaf leaf, ParsedElementAnnotation parsedElementAnnotation) Called when element annotation is found after a pattern.commentAfter
(Leaf leaf, CommentListImpl commentList) expandPattern
(Leaf leaf) Called after all the parsing is done.Returns theNameClassBuilder
, which is used to build name classes for thisSchemaBuilder
.com.sun.tools.txw2.builder.relaxng.AnnotationsImpl
makeAnnotations
(CommentListImpl commentList, Context context) CreatesAnnotations
object to parse annotations on patterns.makeAttribute
(NameClass nameClass, Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) makeChoice
(List<Leaf> leaves, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) makeDataPatternBuilder
(String datatypeLibrary, String type, LocatorImpl locator) makeElement
(NameClass nameClass, Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) ElementAnnotationBuilder<Leaf,
ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> makeElementAnnotationBuilder
(String ns, String localName, String prefix, LocatorImpl locator, CommentListImpl commentList, Context context) makeEmpty
(LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) makeExternalRef
(Parseable current, String uri, String ns, Scope<Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> scope, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) Grammar<Leaf,
ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> makeGrammar
(Scope<Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> scope) makeGroup
(List<Leaf> leaves, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) makeInterleave
(List<Leaf> leaves, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) makeList
(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) makeLocation
(String systemId, int lineNumber, int columnNumber) makeMixed
(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) makeNotAllowed
(LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) makeOneOrMore
(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) makeOptional
(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) makeText
(LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) makeValue
(String datatypeLibrary, String type, String value, Context c, String ns, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) makeZeroOrMore
(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) boolean
If thisSchemaBuilder
is interested in actually parsing comments, this method returns true.
-
Constructor Details
-
SchemaBuilderImpl
-
-
Method Details
-
expandPattern
Description copied from interface:SchemaBuilder
Called after all the parsing is done.This hook typically allows as
SchemaBuilder
to expand notAllowed (if it's following the simplification as in the spec.)- Specified by:
expandPattern
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
getNameClassBuilder
Description copied from interface:SchemaBuilder
Returns theNameClassBuilder
, which is used to build name classes for thisSchemaBuilder
. TheNameClass
es that are built will then be fed into thisSchemaBuilder
to further build RELAX NG patterns.- Specified by:
getNameClassBuilder
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Returns:
- always return a non-null valid object. This method can (and probably should) always return the same object.
- Throws:
BuildException
-
makeChoice
public Leaf makeChoice(List<Leaf> leaves, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException - Specified by:
makeChoice
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
makeInterleave
public Leaf makeInterleave(List<Leaf> leaves, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException - Specified by:
makeInterleave
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
makeGroup
public Leaf makeGroup(List<Leaf> leaves, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException - Specified by:
makeGroup
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
makeOneOrMore
public Leaf makeOneOrMore(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException - Specified by:
makeOneOrMore
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
makeZeroOrMore
public Leaf makeZeroOrMore(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException - Specified by:
makeZeroOrMore
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
makeOptional
public Leaf makeOptional(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException - Specified by:
makeOptional
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
makeList
public Leaf makeList(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException - Specified by:
makeList
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
makeMixed
public Leaf makeMixed(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException - Specified by:
makeMixed
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
makeEmpty
public Leaf makeEmpty(LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) - Specified by:
makeEmpty
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl>
-
makeNotAllowed
public Leaf makeNotAllowed(LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) - Specified by:
makeNotAllowed
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl>
-
makeText
public Leaf makeText(LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) - Specified by:
makeText
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl>
-
makeAttribute
public Leaf makeAttribute(NameClass nameClass, Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException - Specified by:
makeAttribute
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
makeElement
public Leaf makeElement(NameClass nameClass, Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException - Specified by:
makeElement
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
makeDataPatternBuilder
public DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary, String type, LocatorImpl locator) throws BuildException - Specified by:
makeDataPatternBuilder
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
makeValue
public Leaf makeValue(String datatypeLibrary, String type, String value, Context c, String ns, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException - Specified by:
makeValue
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
makeGrammar
public Grammar<Leaf,ParsedElementAnnotation, makeGrammarLocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> (Scope<Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> scope) - Specified by:
makeGrammar
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Parameters:
scope
- The parent scope. null if there's no parent scope. For example, if the complete document looks like the following:
Then when the outer-most<grammar> <start><element name="root"><empty/></element></start> </grammar>
Grammar
is created, it will receive thenull
parent.
-
annotate
public Leaf annotate(Leaf leaf, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException Description copied from interface:SchemaBuilder
Called when annotation is found right inside a pattern such as,<element name="foo"> <!-- this becomes 'P' --> <foreign:annotation /> <!-- this becomes 'A' --> ... </element>
- Specified by:
annotate
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
annotateAfter
public Leaf annotateAfter(Leaf leaf, ParsedElementAnnotation parsedElementAnnotation) throws BuildException Description copied from interface:SchemaBuilder
Called when element annotation is found after a pattern. such as,<element name="foo"> <empty /> <!-- this becomes 'P' --> <foreign:annotation /> <!-- this becomes 'E' --> </element>
- Specified by:
annotateAfter
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-
makeErrorPattern
- Specified by:
makeErrorPattern
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl>
-
usesComments
public boolean usesComments()Description copied from interface:SchemaBuilder
If thisSchemaBuilder
is interested in actually parsing comments, this method returns true.Returning false allows the schema parser to speed up the processing by skiping comment-related handlings.
- Specified by:
usesComments
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl>
-
makeExternalRef
public Leaf makeExternalRef(Parseable current, String uri, String ns, Scope<Leaf, ParsedElementAnnotation, throws BuildException, IllegalSchemaExceptionLocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> scope, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) - Specified by:
makeExternalRef
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Parameters:
current
- Current grammar that we are parsing. This is what contains externalRef.scope
- The parent scope. null if there's no parent scope. SeeSchemaBuilder.makeGrammar(Scope)
for more details about when this parameter can be null.- Throws:
BuildException
IllegalSchemaException
-
makeLocation
- Specified by:
makeLocation
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl>
-
makeAnnotations
public com.sun.tools.txw2.builder.relaxng.AnnotationsImpl makeAnnotations(CommentListImpl commentList, Context context) Description copied from interface:SchemaBuilder
CreatesAnnotations
object to parse annotations on patterns.- Specified by:
makeAnnotations
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Returns:
- must be non-null.
-
makeElementAnnotationBuilder
public ElementAnnotationBuilder<Leaf,ParsedElementAnnotation, makeElementAnnotationBuilderLocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> (String ns, String localName, String prefix, LocatorImpl locator, CommentListImpl commentList, Context context) - Specified by:
makeElementAnnotationBuilder
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl>
-
makeCommentList
- Specified by:
makeCommentList
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl>
-
commentAfter
- Specified by:
commentAfter
in interfaceSchemaBuilder<NameClass,
Leaf, ParsedElementAnnotation, LocatorImpl, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl, CommentListImpl> - Throws:
BuildException
-