NodeWithRange<Node>
, NodeWithTokenRange<Node>
, Observable
, Visitable
, HasParentNode<Node>
, Cloneable
BlockComment
, JavadocComment
, LineComment
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 | Description |
---|---|
Comment(TokenRange tokenRange,
String content) |
This constructor is used by the parser and is considered private.
|
Comment(String content) |
Modifier and Type | Method | 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.
|
getAncestorOfType
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
containsWithin, getBegin, getEnd, isPositionedAfter, isPositionedBefore
public Comment(String content)
@Generated("com.github.javaparser.generator.core.node.MainConstructorGenerator") public Comment(TokenRange tokenRange, String content)
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public String getContent()
@Generated("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("com.github.javaparser.generator.core.node.RemoveMethodGenerator") public boolean remove(Node node)
@Generated("com.github.javaparser.generator.core.node.CloneGenerator") public Comment clone()
@Generated("com.github.javaparser.generator.core.node.GetMetaModelGenerator") public CommentMetaModel getMetaModel()
getMetaModel
in class Node
@Generated("com.github.javaparser.generator.core.node.ReplaceMethodGenerator") public boolean replace(Node node, Node replacementNode)
Copyright © 2007–2019. All rights reserved.