public abstract class Comment extends Node
BlockComment
,
LineComment
,
JavadocComment
Node.BreadthFirstIterator, Node.DirectChildrenIterator, Node.ObserverRegistrationMode, Node.ParentsVisitor, Node.Parsedness, Node.PostOrderIterator, Node.PreOrderIterator, Node.TreeTraversal
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, LINE_SEPARATOR_KEY, NODE_BY_BEGIN_POSITION, PHANTOM_KEY, prettyPrinterNoCommentsConfiguration, PRINTER_KEY, SYMBOL_RESOLVER_KEY
Constructor and Description |
---|
Comment(String content) |
Comment(TokenRange tokenRange,
String content)
This constructor is used by the parser and is considered private.
|
addOrphanComment, containsData, createDefaultPrinter, createDefaultPrinter, customInitialization, equals, findAll, findAll, findAll, findByRange, findCompilationUnit, findData, findFirst, findFirst, findFirst, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getDataKeys, getDefaultPrinterConfiguration, getLineEndingStyle, getLineEndingStyleOrDefault, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getPrinter, getPrinter, getRange, getSymbolResolver, getTokenRange, hashCode, hasScope, isAncestorOf, isPhantom, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeComment, removeData, removeForced, removeOrphanComment, replace, replace, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, stream, stream, toString, toString, tryAddImportToParentCompilationUnit, unregister, walk, walk, walk
finalize, getClass, notify, notifyAll, wait, wait, wait
findAncestor, findAncestor, findAncestor, hasParentNode, isDescendantOf
containsWithin, containsWithinRange, getBegin, getEnd, hasRange
public Comment(String content)
public Comment(TokenRange tokenRange, String content)
public String getContent()
public Comment setContent(String content)
content
- the text of the comment to setpublic boolean isLineComment()
public LineComment asLineComment()
public Comment setCommentedNode(Node commentedNode)
commentedNode
- the commentedNode, can be nullpublic boolean isOrphan()
public Node setComment(Comment comment)
Node
setComment
in class Node
comment
- to be setpublic boolean remove()
Node
public Node findRootNode()
Node
findRootNode
in class Node
public CommentMetaModel getMetaModel()
getMetaModel
in class Node
public boolean isBlockComment()
public BlockComment asBlockComment()
public boolean isJavadocComment()
public JavadocComment asJavadocComment()
public void ifBlockComment(Consumer<BlockComment> action)
public void ifJavadocComment(Consumer<JavadocComment> action)
public void ifLineComment(Consumer<LineComment> action)
public Optional<BlockComment> toBlockComment()
public Optional<JavadocComment> toJavadocComment()
public Optional<LineComment> toLineComment()
public abstract String getHeader()
public abstract String getFooter()
public String asString()
Copyright © 2007–2024. All rights reserved.