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 java.lang.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 Constructor Description SchemaBuilderImpl(JCodeModel codeModel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Leafannotate(Leaf leaf, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations)Called when annotation is found right inside a pattern such as,LeafannotateAfter(Leaf leaf, ParsedElementAnnotation parsedElementAnnotation)Called when element annotation is found after a pattern.LeafcommentAfter(Leaf leaf, CommentListImpl commentList)LeafexpandPattern(Leaf leaf)Called after all the parsing is done.NameClassBuildergetNameClassBuilder()Returns theNameClassBuilder, which is used to build name classes for thisSchemaBuilder.com.sun.tools.txw2.builder.relaxng.AnnotationsImplmakeAnnotations(CommentListImpl commentList, Context context)CreatesAnnotationsobject to parse annotations on patterns.LeafmakeAttribute(NameClass nameClass, Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations)LeafmakeChoice(java.util.List<Leaf> leaves, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations)CommentListImplmakeCommentList()DataPatternBuildermakeDataPatternBuilder(java.lang.String datatypeLibrary, java.lang.String type, LocatorImpl locator)LeafmakeElement(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(java.lang.String ns, java.lang.String localName, java.lang.String prefix, LocatorImpl locator, CommentListImpl commentList, Context context)LeafmakeEmpty(LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations)LeafmakeErrorPattern()LeafmakeExternalRef(Parseable current, java.lang.String uri, java.lang.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)LeafmakeGroup(java.util.List<Leaf> leaves, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations)LeafmakeInterleave(java.util.List<Leaf> leaves, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations)LeafmakeList(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations)LocatorImplmakeLocation(java.lang.String systemId, int lineNumber, int columnNumber)LeafmakeMixed(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations)LeafmakeNotAllowed(LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations)LeafmakeOneOrMore(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations)LeafmakeOptional(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations)LeafmakeText(LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations)LeafmakeValue(java.lang.String datatypeLibrary, java.lang.String type, java.lang.String value, Context c, java.lang.String ns, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations)LeafmakeZeroOrMore(Leaf leaf, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations)booleanusesComments()If thisSchemaBuilderis interested in actually parsing comments, this method returns true.
-
-
-
Constructor Detail
-
SchemaBuilderImpl
public SchemaBuilderImpl(JCodeModel codeModel)
-
-
Method Detail
-
expandPattern
public Leaf expandPattern(Leaf leaf) throws BuildException
Description copied from interface:SchemaBuilderCalled after all the parsing is done.This hook typically allows as
SchemaBuilderto expand notAllowed (if it's following the simplification as in the spec.)- Specified by:
expandPatternin interfaceSchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl>- Throws:
BuildException
-
getNameClassBuilder
public NameClassBuilder getNameClassBuilder() throws BuildException
Description copied from interface:SchemaBuilderReturns theNameClassBuilder, which is used to build name classes for thisSchemaBuilder. TheNameClasses that are built will then be fed into thisSchemaBuilderto further build RELAX NG patterns.- Specified by:
getNameClassBuilderin 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(java.util.List<Leaf> leaves, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException
- Specified by:
makeChoicein interfaceSchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl>- Throws:
BuildException
-
makeInterleave
public Leaf makeInterleave(java.util.List<Leaf> leaves, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException
- Specified by:
makeInterleavein interfaceSchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl>- Throws:
BuildException
-
makeGroup
public Leaf makeGroup(java.util.List<Leaf> leaves, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException
- Specified by:
makeGroupin 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:
makeOneOrMorein 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:
makeZeroOrMorein 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:
makeOptionalin 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:
makeListin 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:
makeMixedin 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:
makeEmptyin 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:
makeNotAllowedin 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:
makeTextin 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:
makeAttributein 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:
makeElementin interfaceSchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl>- Throws:
BuildException
-
makeDataPatternBuilder
public DataPatternBuilder makeDataPatternBuilder(java.lang.String datatypeLibrary, java.lang.String type, LocatorImpl locator) throws BuildException
- Specified by:
makeDataPatternBuilderin interfaceSchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl>- Throws:
BuildException
-
makeValue
public Leaf makeValue(java.lang.String datatypeLibrary, java.lang.String type, java.lang.String value, Context c, java.lang.String ns, LocatorImpl locator, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException
- Specified by:
makeValuein interfaceSchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl>- Throws:
BuildException
-
makeGrammar
public 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)
- Specified by:
makeGrammarin 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>Grammaris created, it will receive thenullparent.
-
annotate
public Leaf annotate(Leaf leaf, com.sun.tools.txw2.builder.relaxng.AnnotationsImpl annotations) throws BuildException
Description copied from interface:SchemaBuilderCalled when annotation is found right inside a pattern such as,<element name="foo"> <!-- this becomes 'P' --> <foreign:annotation /> <!-- this becomes 'A' --> ... </element>- Specified by:
annotatein 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:SchemaBuilderCalled 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:
annotateAfterin interfaceSchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl>- Throws:
BuildException
-
makeErrorPattern
public Leaf makeErrorPattern()
- Specified by:
makeErrorPatternin interfaceSchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl>
-
usesComments
public boolean usesComments()
Description copied from interface:SchemaBuilderIf thisSchemaBuilderis 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:
usesCommentsin interfaceSchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl>
-
makeExternalRef
public Leaf makeExternalRef(Parseable current, java.lang.String uri, java.lang.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) throws BuildException, IllegalSchemaException
- Specified by:
makeExternalRefin 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:
BuildExceptionIllegalSchemaException
-
makeLocation
public LocatorImpl makeLocation(java.lang.String systemId, int lineNumber, int columnNumber)
- Specified by:
makeLocationin 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:SchemaBuilderCreatesAnnotationsobject to parse annotations on patterns.- Specified by:
makeAnnotationsin interfaceSchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl>- Returns:
- must be non-null.
-
makeElementAnnotationBuilder
public ElementAnnotationBuilder<Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl> makeElementAnnotationBuilder(java.lang.String ns, java.lang.String localName, java.lang.String prefix, LocatorImpl locator, CommentListImpl commentList, Context context)
- Specified by:
makeElementAnnotationBuilderin interfaceSchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl>
-
makeCommentList
public CommentListImpl makeCommentList()
- Specified by:
makeCommentListin interfaceSchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl>
-
commentAfter
public Leaf commentAfter(Leaf leaf, CommentListImpl commentList) throws BuildException
- Specified by:
commentAfterin interfaceSchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,com.sun.tools.txw2.builder.relaxng.AnnotationsImpl,CommentListImpl>- Throws:
BuildException
-
-