public class JSDocEmitter extends Object implements IDocEmitter, IEmitter
Constructor and Description |
---|
JSDocEmitter(IJSEmitter emitter) |
Modifier and Type | Method and Description |
---|---|
void |
begin() |
void |
end() |
String |
flushBuffer() |
protected StringBuilder |
getBuilder() |
void |
indentPop()
Pops an indent from the emitter so after newlines are emitted, the output
is correctly formatted.
|
void |
indentPush()
Pushes an indent into the emitter so after newlines are emitted, the
output is correctly formatted.
|
boolean |
isBufferWrite() |
void |
setBufferWrite(boolean value) |
String |
stringifyNode(IASNode node)
Takes the node argument and created a String representation if it using
the buffer temporarily.
|
void |
write(IEmitterTokens value)
Writes a string to the writer.
|
void |
write(String value) |
void |
writeBlockClose() |
void |
writeBlockOpen() |
void |
writeNewline()
Writes newline character(s)
|
void |
writeNewline(IEmitterTokens value)
Writes the
value and then a newline which will automatically
have the indent applied after the \n character. |
void |
writeNewline(IEmitterTokens value,
boolean pushIndent)
Writes the
value after a push or pop of the indent. |
void |
writeNewline(String value) |
void |
writeNewline(String value,
boolean pushIndent) |
void |
writeToken(IEmitterTokens value)
Writes a
ASEmitterTokens character to the buffer and appends a
space after automatically. |
void |
writeToken(String value) |
protected IEmitter emitter
public JSDocEmitter(IJSEmitter emitter)
protected StringBuilder getBuilder()
public boolean isBufferWrite()
public void setBufferWrite(boolean value)
setBufferWrite
in interface IDocEmitter
public String flushBuffer()
flushBuffer
in interface IDocEmitter
public void indentPush()
IEmitter
indentPush
in interface IEmitter
public void indentPop()
IEmitter
public void write(IEmitterTokens value)
IEmitter
public void writeNewline()
IEmitter
writeNewline
in interface IEmitter
public void writeNewline(String value)
writeNewline
in interface IEmitter
public void writeNewline(IEmitterTokens value)
IEmitter
value
and then a newline which will automatically
have the indent applied after the \n character.writeNewline
in interface IEmitter
value
- The String value to write before the \n is appended.public void writeNewline(String value, boolean pushIndent)
writeNewline
in interface IEmitter
public void writeNewline(IEmitterTokens value, boolean pushIndent)
IEmitter
value
after a push or pop of the indent.
This method effectively lets you write a value and then indent our
outdent. The method can be useful in the following where your cursor
writer is at [0]
, you write
writeNewline("if (foo) {", true);
and the cursor after the
call will end up at [1]
.
[0]if (foo) { [1]this.something; }
writeNewline
in interface IEmitter
value
- The String value to write before the \n is appended.pushIndent
- Whether to push indent true
or pop indent
false
.public void writeToken(IEmitterTokens value)
IEmitter
ASEmitterTokens
character to the buffer and appends a
space after automatically.writeToken
in interface IEmitter
value
- The ASEmitterTokens
value.public void writeToken(String value)
writeToken
in interface IEmitter
public void writeBlockClose()
public void writeBlockOpen()
public void begin()
begin
in interface IDocEmitter
public void end()
end
in interface IDocEmitter
public String stringifyNode(IASNode node)
IEmitter
Note; This method is still beta, it need more logic if an emitter is actually using the buffer!
stringifyNode
in interface IEmitter
node
- The node walk and create a String for.Copyright © 2016 The Apache Software Foundation. All rights reserved.