Class BaseDoc
java.lang.Object
io.github.mmm.code.base.item.BaseItem
io.github.mmm.code.base.item.BaseMutableItem
io.github.mmm.code.base.node.BaseNodeItem
io.github.mmm.code.base.doc.BaseDoc
- All Implemented Interfaces:
io.github.mmm.code.api.CodeWithContext, io.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.element.CodeElement, io.github.mmm.code.api.doc.CodeDoc>, io.github.mmm.code.api.doc.CodeDoc, io.github.mmm.code.api.item.CodeItem, io.github.mmm.code.api.item.CodeMutableItem, io.github.mmm.code.api.merge.CodeMergeableItem<io.github.mmm.code.api.doc.CodeDoc>, io.github.mmm.code.api.merge.CodeSimpleMergeableItem<io.github.mmm.code.api.doc.CodeDoc>, io.github.mmm.code.api.node.CodeNode, io.github.mmm.code.api.node.CodeNodeItem, io.github.mmm.code.api.object.CodeMutable
Base implementation of
CodeDoc.- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
Field Summary
Fields inherited from interface io.github.mmm.code.api.doc.CodeDoc
NO_LINES, TAG_CODE, TAG_LINK, TAG_LINKPLAIN, TAG_LITERAL, TAG_PARAM, TAG_RETURN, TAG_THROWS, TAG_VALUEFields inherited from interface io.github.mmm.code.api.item.CodeItem
DEFAULT_INDENT, DEFAULT_NEWLINE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidadd(Collection<String> textLines) copy()copy(io.github.mmm.code.api.copy.CodeCopyMapper mapper) protected voidCalled fromBaseMutableItem.initialize()on first invocation.protected voidCalled on the first call ofBaseMutableItem.setImmutable().protected voiddoWrite(Appendable sink, String newline, String defaultIndent, String currentIndent, io.github.mmm.code.api.language.CodeLanguage language) getFormatted(io.github.mmm.code.api.doc.CodeDocFormat format, String newline) protected PatterngetLines()booleanisEmpty()protected booleanio.github.mmm.code.api.doc.CodeDocmerge(io.github.mmm.code.api.doc.CodeDoc other, io.github.mmm.code.api.merge.CodeMergeStrategy strategy) protected StringresolveLinkQualifiedName(io.github.mmm.code.api.doc.CodeDocLink link) protected StringresolveLinkRelative(io.github.mmm.code.api.doc.CodeDocLink link) protected StringresolveLinkUrl(io.github.mmm.code.api.doc.CodeDocLink link) protected StringresolveLinkUrl(String url, io.github.mmm.code.api.doc.CodeDocLink link, boolean absolute) protected ObjectresolveLinkValue(io.github.mmm.code.api.doc.CodeDocLink link) Methods inherited from class BaseNodeItem
getContainerItem, getContainerItemDeclared, getContext, getLanguage, getSource, toPathStringMethods inherited from class BaseMutableItem
doCopyNode, doCopyNodeUnsafe, doMapList, doneInitialize, getDefaultCopyMapper, getDefaultEncoding, getReflectiveObject, getSourceCodeObject, initialize, initialize, isImmutable, isInitialized, isInitializing, isSystemImmutable, makeImmutable, makeImmutable, setImmutable, setImmutableIfNotSystemImmutable, verifyMutalbe, writeItemMethods inherited from class BaseItem
getOwningType, getSourceCode, getSpaces, toString, writeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.github.mmm.code.api.doc.CodeDoc
getFormatted, getLinesAsArrayMethods inherited from interface io.github.mmm.code.api.item.CodeItem
getLanguage, getSourceCode, write, write, write, write, write, writeMethods inherited from interface io.github.mmm.code.api.object.CodeMutable
isImmutable, isMutableMethods inherited from interface io.github.mmm.code.api.item.CodeMutableItem
getReflectiveObject, setImmutableMethods inherited from interface io.github.mmm.code.api.merge.CodeSimpleMergeableItem
mergeMethods inherited from interface io.github.mmm.code.api.CodeWithContext
getContext, getSource
-
Constructor Details
-
BaseDoc
-
BaseDoc
-
-
Method Details
-
getParent
- Specified by:
getParentin interfaceio.github.mmm.code.api.node.CodeNode- Specified by:
getParentin interfaceio.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.element.CodeElement, io.github.mmm.code.api.doc.CodeDoc>
-
doInitialize
protected void doInitialize()Description copied from class:BaseNodeItemCalled fromBaseMutableItem.initialize()on first invocation. May be overridden but never be called from anywhere else.- Overrides:
doInitializein classBaseNodeItem
-
doSetImmutable
protected void doSetImmutable()Description copied from class:BaseMutableItemCalled on the first call ofBaseMutableItem.setImmutable(). Has to be overridden to updateCollections, make child items immutable, etc.- Overrides:
doSetImmutablein classBaseMutableItem
-
isSystemImmutable
protected boolean isSystemImmutable()- Overrides:
isSystemImmutablein classBaseMutableItem- Returns:
trueif this is a system internal node item that is considered to beimmutablebut is technicallyset to immutableduring (lazy)initialization. Otherwisefalse.
-
getLines
-
add
- Specified by:
addin interfaceio.github.mmm.code.api.doc.CodeDoc
-
add
- Specified by:
addin interfaceio.github.mmm.code.api.doc.CodeDoc
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceio.github.mmm.code.api.doc.CodeDoc
-
getFormatted
-
getInlineTagPattern
-
resolveLinkValue
- Parameters:
link- theBaseDocLinkto resolve as value (e.g. to resolve "@{value Foo#BAR}" or "@{value}").- Returns:
- the resolved value.
-
resolveLinkUrl
- Parameters:
link- theBaseDocLinkto resolve.- Returns:
- the
BaseDocLinkresolved as URL.
-
resolveLinkQualifiedName
- Parameters:
link- theBaseDocLinkto resolve.- Returns:
- the
qualified nameof theBaseDocLink. In case it isnullthe resolved qualified name from thesimple name.
-
resolveLinkUrl
protected String resolveLinkUrl(String url, io.github.mmm.code.api.doc.CodeDocLink link, boolean absolute) - Parameters:
url- the base URL or relative path.link- theBaseDocLink.absolute- -trueif thequalified nameshould be appended as path to the URL,falseotherwise.- Returns:
- the resolved URL.
-
resolveLinkRelative
- Parameters:
link- theBaseDocLinkto resolve.- Returns:
- the path relative to this context.
-
merge
public io.github.mmm.code.api.doc.CodeDoc merge(io.github.mmm.code.api.doc.CodeDoc other, io.github.mmm.code.api.merge.CodeMergeStrategy strategy) - Specified by:
mergein interfaceio.github.mmm.code.api.merge.CodeSimpleMergeableItem<io.github.mmm.code.api.doc.CodeDoc>
-
copy
- Specified by:
copyin interfaceio.github.mmm.code.api.item.CodeMutableItem- Specified by:
copyin interfaceio.github.mmm.code.api.node.CodeNodeItem- Specified by:
copyin interfaceio.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.element.CodeElement, io.github.mmm.code.api.doc.CodeDoc>
-
copy
- Specified by:
copyin interfaceio.github.mmm.code.api.item.CodeMutableItem- Specified by:
copyin interfaceio.github.mmm.code.api.node.CodeNodeItem- Specified by:
copyin interfaceio.github.mmm.code.api.copy.CodeNodeItemCopyable<io.github.mmm.code.api.element.CodeElement, io.github.mmm.code.api.doc.CodeDoc>
-
doWrite
protected void doWrite(Appendable sink, String newline, String defaultIndent, String currentIndent, io.github.mmm.code.api.language.CodeLanguage language) throws IOException - Specified by:
doWritein classBaseItem- Parameters:
sink- theAppendablewhere toappendthe code from thisCodeItem.newline- the newlineString.defaultIndent- theStringused for indentation (e.g. a number of spaces to insert per indent level).currentIndent- the current indent (number of spaces). Initially the empty string (""). Before a recursion thedefaultIndentwill be appended.language- theCodeLanguageto use.- Throws:
IOException- if thrown byAppendable.- See Also:
-