java.lang.Object | |
↳ | com.pnfsoftware.jeb.core.output.code.CodeDocumentPart |
Known Direct Subclasses |
Known Indirect Subclasses |
A document part specific to code outputs. Use with CodeDocument
Remember to call
registerAnchor(String)
before generating content at a given anchor point.
The type of ILine used is CodeLine
. The type of IAnchor used is CodeAnchor
.
Clients must extend this class.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
protected String | indentString | ||||||||||
protected String | paddingString |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CodeDocumentPart(long baseAnchorId)
Create a new code document part, attached to the given anchor.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | append(String str, ItemClassIdentifiers classId) | ||||||||||
void | append(String s) | ||||||||||
void |
append(String s, int[] aActualInsertionIndex)
Append a chunk of text to the current line.
| ||||||||||
void |
appendAndRecord(String s, ItemClassIdentifiers classId, long itemId, int flags)
Append a chunk of text to the current line.
| ||||||||||
void |
appendAndRecord(String s, ItemClassIdentifiers classId, long itemId)
Append a chunk of text to the current line.
| ||||||||||
void |
appendAndRecord(String s, ItemClassIdentifiers classId)
Append a chunk of text to the current line.
| ||||||||||
void | appendComment(String text, boolean auto) | ||||||||||
void | appendComment(String text) | ||||||||||
void | appendCommentAuto(String text) | ||||||||||
void |
appendKeyword(String keyword)
Convenience method.
| ||||||||||
void | appendKeyword(String keyword, long itemId) | ||||||||||
void | appendMulti(String s) | ||||||||||
void |
appendParameterSeparator()
Append a parameter separator to the current line.
| ||||||||||
void | brace() | ||||||||||
void | braceClose() | ||||||||||
void | bracket() | ||||||||||
void | bracketClose() | ||||||||||
void | decrementIndentationLevel() | ||||||||||
void | disablePadding() | ||||||||||
void | enablePadding() | ||||||||||
static boolean |
enableTokenFlattening(boolean enabled)
Enable or disable token flattening.
| ||||||||||
void |
eol()
End the current line.
| ||||||||||
void |
eol(ICodeCoordinates lineCoord)
End the current line.
| ||||||||||
String | format() | ||||||||||
List<CodeAnchor> |
getAnchors()
Get the anchors within that part.
| ||||||||||
CodeAnchor |
getCurrentAnchor()
Get the currently active anchor.
| ||||||||||
ICodeCoordinates | getCurrentCoordinates() | ||||||||||
CodeLine |
getCurrentLine()
Get the last (unfinished) line
| ||||||||||
ICodeCoordinates | getCurrentLineCoordinates() | ||||||||||
int |
getCurrentLineIndex()
Same as
getLineCount() . | ||||||||||
int | getCurrentLineLength() | ||||||||||
int | getCurrentMarginLength() | ||||||||||
ICodeCoordinates | getCurrentMostPreciseCodeCoordinates() | ||||||||||
int | getIndentationLevel() | ||||||||||
String | getIndentationString() | ||||||||||
int |
getLastLineIndex()
Get the index of the last finished line.
| ||||||||||
CodeLine | getLine(int index) | ||||||||||
int |
getLineCount()
Get the number of finished (EOL-terminated) lines in this part.
| ||||||||||
List<CodeLine> |
getLines()
Get the lines within that part.
| ||||||||||
List<ObjectLocation> |
getObjectLocations()
Retrieve the list of objects represented in the part, as well as their locations (line
start/end, column start/end).
| ||||||||||
void | incrementIndentationLevel() | ||||||||||
void | indentReset() | ||||||||||
boolean | isCurrentLineEmpty() | ||||||||||
void | markCurrentPosition(String name, Object object) | ||||||||||
boolean | moveLastLine(int newIndex) | ||||||||||
boolean | moveLine(int index, int newIndex) | ||||||||||
void | paren() | ||||||||||
void | parenClose() | ||||||||||
void | prependCodePart(CodeDocumentPart part) | ||||||||||
void | recordCurrentCoordinates(ICodeCoordinates coordinates) | ||||||||||
void | recordLineCoordinates(ICodeCoordinates coordinates) | ||||||||||
void | recordObjectLocation(Object object, boolean begin, int depth) | ||||||||||
boolean |
registerAnchor(String name)
Create an anchor using the current (next) anchor id, and register it at the current last
line.
| ||||||||||
boolean |
registerAnchor(long anchorId, String name)
Create an anchor with the provided anchor id, and register it at the current last line.
| ||||||||||
void | resetPaddingString() | ||||||||||
void | setIndentationLevel(int level) | ||||||||||
void | setIndentationString(String indentString) | ||||||||||
void | setPaddingString(String paddingString) | ||||||||||
void |
setParameterSeparator(String parameterSeparator)
Set the parameter separator.
| ||||||||||
void |
space()
Append a space to the current line.
| ||||||||||
void |
space(int cnt)
Append one or more spaces to the current line.
| ||||||||||
String | toString() | ||||||||||
void | unrecordCurrentCoordinates() | ||||||||||
void | unrecordLineCoordinates() | ||||||||||
void | validate() |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | appendKeyword(int id) | ||||||||||
int |
registerKeyword(String keyword)
Register a keyword for future fast appending.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.pnfsoftware.jeb.core.output.code.ICodeDocument
| |||||||||||
From interface
com.pnfsoftware.jeb.core.output.text.ITextDocumentPart
|
Create a new code document part, attached to the given anchor. An 8-space padding and a 4-space indentation is selected by default.
baseAnchorId | the base anchor identifier |
---|
Append a chunk of text to the current line. The line should not contain CR/LF characters.
s | chunk of text, should not contain CR or LF characters. If found, they are replaced by slash ('/') characters |
---|---|
aActualInsertionIndex | optional: set the index of the inserted string (can be different from current index because of padding) at 0-index |
Append a chunk of text to the current line.
s | a string |
---|---|
classId | a class identifier |
itemId | an item identifier |
flags | flags |
Append a chunk of text to the current line.
s | a string |
---|---|
classId | a class identifier |
itemId | an item identifier |
Append a chunk of text to the current line.
s | a string |
---|---|
classId | a class identifier |
Convenience method.
Append a parameter separator to the current line. Use setParameterSeparator(String)
to override default.
Enable or disable token flattening. This method is reserved for internal use. Refer to the
Engines property FlattenStringsInCodeDocuments
if you wish to modify whether tokens
should be flattened when they are appended to a text document.
End the current line.
End the current line.
lineCoord | optional chunk coordinates |
---|
Get the anchors within that part. The last anchor object may be used to specify the first anchor id of the next, contiguous part. It is especially useful in cases where a line spans multiple anchor ids.
Get the index of the last finished line.
Get the number of finished (EOL-terminated) lines in this part. A line is finished by calling eol().
Get the lines within that part. The lines may span over one or more anchors.
Retrieve the list of objects represented in the part, as well as their locations (line start/end, column start/end). A given coordinates within the part may host multiple objects.
Implementation of this method is optional; to ensure backward compatibility with existing documents, the default implementation returns an empty collection.
Create an anchor using the current (next) anchor id, and register it at the current last line.
name | the anchor name |
---|
Create an anchor with the provided anchor id, and register it at the current last line.
Set the parameter separator. Default is ", ".
parameterSeparator | new parameter separator |
---|
Append a space to the current line.
Append one or more spaces to the current line.
cnt | the number of spaces to be appended; may be <= 0, in which case, this method will do nothing |
---|
Register a keyword for future fast appending. Use for frequent keywords to bypass some internal checks.
keyword | a keyword ".", ";" for example... |
---|