Interface Comments
@NonExtendable
@AvailableSince("0.6.0")
public interface Comments
Holds a mutable collection of comments bound to a
specific TOML expression
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a comment.default voidadd(@NotNull CommentPosition position, @NotNull String content) Creates and adds a commentdefault voidAlias foradd(CommentPosition.INLINE, content)default voidAlias foradd(CommentPosition.POST, content)default voidAlias foradd(CommentPosition.PRE, content)all()Provides an immutable list of all comments held by this object, in the order they would appear in a document.voidclear()Removes all commentsvoidclear(@NotNull CommentPosition position) Removes all comments of the givenposition.static @NotNull Commentsintcount()Reports the total number of comments, equivalent toall().length()static @NotNull Commentsempty()get(@NotNull CommentPosition position) Provides an immutable list of all comments of the givenpositionin insertion order.default @Nullable StringGets the content of theINLINEcomment, if any is set.default voidSets the content of the inline comment, or clears it if null
-
Method Details
-
empty
-
copyOf
-
count
int count()Reports the total number of comments, equivalent toall().length() -
all
Provides an immutable list of all comments held by this object, in the order they would appear in a document. Comments are sorted byposition, then by insertion order. -
get
Provides an immutable list of all comments of the givenpositionin insertion order. -
getInline
Gets the content of theINLINEcomment, if any is set. -
clear
void clear()Removes all comments -
clear
Removes all comments of the givenposition. -
add
Adds a comment. If the position of the comment isINLINE, any existing inline comment is replaced. -
add
Creates and adds a comment- Parameters:
position- Position of the comment. IfINLINE, any existing inline comment is replaced.content- Content of the comment- See Also:
-
addPre
Alias foradd(CommentPosition.PRE, content)- See Also:
-
addInline
Alias foradd(CommentPosition.INLINE, content)- See Also:
-
setInline
Sets the content of the inline comment, or clears it if null -
addPost
Alias foradd(CommentPosition.POST, content)- See Also:
-