public abstract class Comment extends Node
BlockComment
,
LineComment
,
JavadocComment
Node.ObserverRegistrationMode
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration
Modifier and Type | Method and Description |
---|---|
LineComment |
asLineComment() |
Optional<Node> |
getCommentedNode() |
String |
getContent()
Return the text of the comment.
|
boolean |
isLineComment() |
boolean |
isOrphan() |
boolean |
remove()
Try to remove this node from the parent
|
Comment |
setCommentedNode(Node commentedNode)
Sets the commentedNode
|
Comment |
setContent(String content)
Sets the text of the comment.
|
addOrphanComment, clone, containsWithin, equals, getAllContainedComments, getBegin, getChildNodes, getComment, getData, getEnd, getNodeLists, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getRange, hasComment, hashCode, isPositionedAfter, isPositionedBefore, isRegistered, notifyPropertyChange, register, register, registerForSubtree, removeOrphanComment, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setRange, toString, toString, tryAddImportToParentCompilationUnit, unregister
finalize, getClass, notify, notifyAll, wait, wait, wait
getAncestorOfType, setAsParentNodeOf, setAsParentNodeOf
public final 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()
Copyright © 2007–2017. All rights reserved.