Class CommentThreads<T extends Comment>
- java.lang.Object
-
- com.google.gerrit.server.change.CommentThreads<T>
-
- Type Parameters:
T
- type of comments in the threads. Can also beComment
if the threads mix comments of different types.
public class CommentThreads<T extends Comment> extends Object
Identifier of comment threads.Comments are ordered into threads according to their parent relationship indicated via
Comment.parentUuid
. It's possible that two comments refer to the same parent, which especially happens when two persons reply in parallel. If such branches exist, we merge them into a flat list taking the comment creation date (Comment.writtenOn
into account (but still preserving the general parent order). Remaining ties are resolved by using the natural order of the comment UUID, which is unique.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T extends Comment>
CommentThreads<T>forComments(Iterable<T> comments)
com.google.common.collect.ImmutableSet<CommentThread<T>>
getThreads()
Returns all comments organized into threads.com.google.common.collect.ImmutableSet<CommentThread<T>>
getThreadsForChildren(Iterable<? extends T> childComments)
Returns only the comment threads to which the specified comments are a reply.
-
-
-
Method Detail
-
forComments
public static <T extends Comment> CommentThreads<T> forComments(Iterable<T> comments)
-
getThreads
public com.google.common.collect.ImmutableSet<CommentThread<T>> getThreads()
Returns all comments organized into threads.Comments appear only once.
-
getThreadsForChildren
public com.google.common.collect.ImmutableSet<CommentThread<T>> getThreadsForChildren(Iterable<? extends T> childComments)
Returns only the comment threads to which the specified comments are a reply.If the specified child comments are part of the comments originally provided to
forComments(Iterable)
, they will also appear in the returned comment threads. They don't need to be part of the originally provided comments, though, but should refer to one of these comments via theirComment.parentUuid
. Child comments not referring to any known comments will be ignored.- Parameters:
childComments
- comments for which the matching threads should be determined- Returns:
- threads to which the provided child comments are a reply
-
-