Class GeneratorUtils.MojoParserCallback
- java.lang.Object
-
- javax.swing.text.html.HTMLEditorKit.ParserCallback
-
- org.apache.maven.tools.plugin.generator.GeneratorUtils.MojoParserCallback
-
- Enclosing class:
- GeneratorUtils
private static class GeneratorUtils.MojoParserCallback extends javax.swing.text.html.HTMLEditorKit.ParserCallback
ParserCallback implementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
GeneratorUtils.MojoParserCallback.Counter
Holds the index of the current item in a numbered list.
-
Field Summary
Fields Modifier and Type Field Description private boolean
body
A flag whether the parser is currently in the body element.private int
depth
The current indentation depth for the output.private java.util.Stack<GeneratorUtils.MojoParserCallback.Counter>
numbering
A stack ofGeneratorUtils.MojoParserCallback.Counter
objects corresponding to the nesting of (un-)ordered lists.private boolean
pendingNewline
A flag whether an implicit line break is pending in the output buffer.private int
preformatted
A flag whether the parser is currently processing preformatted text, actually a counter to track nesting.private java.lang.StringBuilder
sb
The current buffer.private boolean
simpleTag
A flag whether we have just parsed a simple tag.
-
Constructor Summary
Constructors Constructor Description MojoParserCallback(java.lang.StringBuilder sb)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
flush()
private void
flushPendingNewline()
Flushes a pending newline (if any).void
handleEndTag(javax.swing.text.html.HTML.Tag t, int pos)
void
handleSimpleTag(javax.swing.text.html.HTML.Tag t, javax.swing.text.MutableAttributeSet a, int pos)
void
handleStartTag(javax.swing.text.html.HTML.Tag t, javax.swing.text.MutableAttributeSet a, int pos)
void
handleText(char[] data, int pos)
private void
newline(boolean implicit)
Writes a line break to the plain text output.private void
text(java.lang.String data)
Writes the specified character data to the plain text output.
-
-
-
Field Detail
-
body
private boolean body
A flag whether the parser is currently in the body element.
-
preformatted
private int preformatted
A flag whether the parser is currently processing preformatted text, actually a counter to track nesting.
-
depth
private int depth
The current indentation depth for the output.
-
numbering
private java.util.Stack<GeneratorUtils.MojoParserCallback.Counter> numbering
A stack ofGeneratorUtils.MojoParserCallback.Counter
objects corresponding to the nesting of (un-)ordered lists. Anull
element denotes an unordered list.
-
pendingNewline
private boolean pendingNewline
A flag whether an implicit line break is pending in the output buffer. This flag is used to postpone the output of implicit line breaks until we are sure that are not to be merged with other implicit line breaks.
-
simpleTag
private boolean simpleTag
A flag whether we have just parsed a simple tag.
-
sb
private final java.lang.StringBuilder sb
The current buffer.
-
-
Method Detail
-
handleSimpleTag
public void handleSimpleTag(javax.swing.text.html.HTML.Tag t, javax.swing.text.MutableAttributeSet a, int pos)
- Overrides:
handleSimpleTag
in classjavax.swing.text.html.HTMLEditorKit.ParserCallback
-
handleStartTag
public void handleStartTag(javax.swing.text.html.HTML.Tag t, javax.swing.text.MutableAttributeSet a, int pos)
- Overrides:
handleStartTag
in classjavax.swing.text.html.HTMLEditorKit.ParserCallback
-
handleEndTag
public void handleEndTag(javax.swing.text.html.HTML.Tag t, int pos)
- Overrides:
handleEndTag
in classjavax.swing.text.html.HTMLEditorKit.ParserCallback
-
handleText
public void handleText(char[] data, int pos)
- Overrides:
handleText
in classjavax.swing.text.html.HTMLEditorKit.ParserCallback
-
flush
public void flush()
- Overrides:
flush
in classjavax.swing.text.html.HTMLEditorKit.ParserCallback
-
newline
private void newline(boolean implicit)
Writes a line break to the plain text output.- Parameters:
implicit
- A flag whether this is an explicit or implicit line break. Explicit line breaks are always written to the output whereas consecutive implicit line breaks are merged into a single line break.
-
flushPendingNewline
private void flushPendingNewline()
Flushes a pending newline (if any).
-
text
private void text(java.lang.String data)
Writes the specified character data to the plain text output. If the last output was a line break, the character data will automatically be prefixed with the current indent.- Parameters:
data
- The character data, must not benull
.
-
-