Package org.kohsuke.rngom.ast.builder
Interface SchemaBuilder<N extends ParsedNameClass,P extends ParsedPattern,E extends ParsedElementAnnotation,L extends Location,A extends Annotations<E,L,CL>,CL extends CommentList<L>>
-
- All Known Implementing Classes:
CheckingSchemaBuilder
,DSchemaBuilderImpl
,SchemaBuilderHost
,SchemaBuilderImpl
,SchemaBuilderImpl
public interface SchemaBuilder<N extends ParsedNameClass,P extends ParsedPattern,E extends ParsedElementAnnotation,L extends Location,A extends Annotations<E,L,CL>,CL extends CommentList<L>>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description P
annotate(P p, A anno)
Called when annotation is found right inside a pattern such as,P
annotateAfter(P p, E e)
Called when element annotation is found after a pattern.P
commentAfter(P p, CL comments)
P
expandPattern(P p)
Called after all the parsing is done.NameClassBuilder<N,E,L,A,CL>
getNameClassBuilder()
Returns theNameClassBuilder
, which is used to build name classes for thisSchemaBuilder
.A
makeAnnotations(CL comments, Context context)
CreatesAnnotations
object to parse annotations on patterns.P
makeAttribute(N nc, P p, L loc, A anno)
P
makeChoice(java.util.List<P> patterns, L loc, A anno)
CL
makeCommentList()
DataPatternBuilder
makeDataPatternBuilder(java.lang.String datatypeLibrary, java.lang.String type, L loc)
P
makeElement(N nc, P p, L loc, A anno)
ElementAnnotationBuilder<P,E,L,A,CL>
makeElementAnnotationBuilder(java.lang.String ns, java.lang.String localName, java.lang.String prefix, L loc, CL comments, Context context)
P
makeEmpty(L loc, A anno)
P
makeErrorPattern()
P
makeExternalRef(Parseable current, java.lang.String uri, java.lang.String ns, Scope<P,E,L,A,CL> scope, L loc, A anno)
Grammar<P,E,L,A,CL>
makeGrammar(Scope<P,E,L,A,CL> parent)
P
makeGroup(java.util.List<P> patterns, L loc, A anno)
P
makeInterleave(java.util.List<P> patterns, L loc, A anno)
P
makeList(P p, L loc, A anno)
L
makeLocation(java.lang.String systemId, int lineNumber, int columnNumber)
P
makeMixed(P p, L loc, A anno)
P
makeNotAllowed(L loc, A anno)
P
makeOneOrMore(P p, L loc, A anno)
P
makeOptional(P p, L loc, A anno)
P
makeText(L loc, A anno)
P
makeValue(java.lang.String datatypeLibrary, java.lang.String type, java.lang.String value, Context c, java.lang.String ns, L loc, A anno)
P
makeZeroOrMore(P p, L loc, A anno)
boolean
usesComments()
If thisSchemaBuilder
is interested in actually parsing comments, this method returns true.
-
-
-
Method Detail
-
getNameClassBuilder
NameClassBuilder<N,E,L,A,CL> getNameClassBuilder() throws BuildException
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.- Returns:
- always return a non-null valid object. This method can (and probably should) always return the same object.
- Throws:
BuildException
-
makeChoice
P makeChoice(java.util.List<P> patterns, L loc, A anno) throws BuildException
- Throws:
BuildException
-
makeInterleave
P makeInterleave(java.util.List<P> patterns, L loc, A anno) throws BuildException
- Throws:
BuildException
-
makeGroup
P makeGroup(java.util.List<P> patterns, L loc, A anno) throws BuildException
- Throws:
BuildException
-
makeOneOrMore
P makeOneOrMore(P p, L loc, A anno) throws BuildException
- Throws:
BuildException
-
makeZeroOrMore
P makeZeroOrMore(P p, L loc, A anno) throws BuildException
- Throws:
BuildException
-
makeOptional
P makeOptional(P p, L loc, A anno) throws BuildException
- Throws:
BuildException
-
makeList
P makeList(P p, L loc, A anno) throws BuildException
- Throws:
BuildException
-
makeMixed
P makeMixed(P p, L loc, A anno) throws BuildException
- Throws:
BuildException
-
makeAttribute
P makeAttribute(N nc, P p, L loc, A anno) throws BuildException
- Throws:
BuildException
-
makeElement
P makeElement(N nc, P p, L loc, A anno) throws BuildException
- Throws:
BuildException
-
makeDataPatternBuilder
DataPatternBuilder makeDataPatternBuilder(java.lang.String datatypeLibrary, java.lang.String type, L loc) throws BuildException
- Throws:
BuildException
-
makeValue
P makeValue(java.lang.String datatypeLibrary, java.lang.String type, java.lang.String value, Context c, java.lang.String ns, L loc, A anno) throws BuildException
- Throws:
BuildException
-
makeGrammar
Grammar<P,E,L,A,CL> makeGrammar(Scope<P,E,L,A,CL> parent)
- Parameters:
parent
- 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
P annotate(P p, A anno) throws BuildException
Called when annotation is found right inside a pattern such as,<element name="foo"> <!-- this becomes 'P' --> <foreign:annotation /> <!-- this becomes 'A' --> ... </element>
- Throws:
BuildException
-
annotateAfter
P annotateAfter(P p, E e) throws BuildException
Called when element annotation is found after a pattern. such as,<element name="foo"> <empty /> <!-- this becomes 'P' --> <foreign:annotation /> <!-- this becomes 'E' --> </element>
- Throws:
BuildException
-
commentAfter
P commentAfter(P p, CL comments) throws BuildException
- Throws:
BuildException
-
makeExternalRef
P makeExternalRef(Parseable current, java.lang.String uri, java.lang.String ns, Scope<P,E,L,A,CL> scope, L loc, A anno) throws BuildException, IllegalSchemaException
- Parameters:
current
- Current grammar that we are parsing. This is what contains externalRef.scope
- The parent scope. null if there's no parent scope. SeemakeGrammar(Scope)
for more details about when this parameter can be null.- Throws:
BuildException
IllegalSchemaException
-
makeLocation
L makeLocation(java.lang.String systemId, int lineNumber, int columnNumber)
-
makeAnnotations
A makeAnnotations(CL comments, Context context)
CreatesAnnotations
object to parse annotations on patterns.- Returns:
- must be non-null.
-
makeElementAnnotationBuilder
ElementAnnotationBuilder<P,E,L,A,CL> makeElementAnnotationBuilder(java.lang.String ns, java.lang.String localName, java.lang.String prefix, L loc, CL comments, Context context)
-
makeCommentList
CL makeCommentList()
-
makeErrorPattern
P makeErrorPattern()
-
usesComments
boolean usesComments()
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.
-
expandPattern
P expandPattern(P p) throws BuildException, IllegalSchemaException
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.)- Throws:
BuildException
IllegalSchemaException
-
-