public abstract class Comment extends Node
BlockComment
,
LineComment
,
JavadocComment
Node.ObserverRegistrationMode, Node.Parsedness
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration
Constructor and Description |
---|
Comment(String content) |
Comment(TokenRange tokenRange,
String content)
This constructor is used by the parser and is considered private.
|
Modifier and Type | Method and Description |
---|---|
LineComment |
asLineComment() |
Comment |
clone() |
Optional<Node> |
getCommentedNode() |
String |
getContent()
Return the text of the comment.
|
CommentMetaModel |
getMetaModel() |
boolean |
isLineComment() |
boolean |
isOrphan() |
boolean |
remove()
Try to remove this node from the parent
|
boolean |
remove(Node node) |
boolean |
replace(Node node,
Node replacementNode) |
Comment |
setCommentedNode(Node commentedNode)
Sets the commentedNode
|
Comment |
setContent(String content)
Sets the text of the comment.
|
addOrphanComment, customInitialization, equals, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getNodeLists, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getRange, getTokenRange, hasComment, hashCode, isRegistered, notifyPropertyChange, register, register, registerForSubtree, removeComment, removeForced, removeOrphanComment, replace, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, toString, toString, tryAddImportToParentCompilationUnit, unregister
finalize, getClass, notify, notifyAll, wait, wait, wait
getAncestorOfType
containsWithin, getBegin, getEnd, isPositionedAfter, isPositionedBefore
public Comment(String content)
@Generated(value="com.github.javaparser.generator.core.node.MainConstructorGenerator") public Comment(TokenRange tokenRange, String content)
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public String getContent()
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") 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 boolean remove()
Node
@Generated(value="com.github.javaparser.generator.core.node.RemoveMethodGenerator") public boolean remove(Node node)
@Generated(value="com.github.javaparser.generator.core.node.CloneGenerator") public Comment clone()
@Generated(value="com.github.javaparser.generator.core.node.GetMetaModelGenerator") public CommentMetaModel getMetaModel()
getMetaModel
in class Node
Copyright © 2007–2017. All rights reserved.