Class ReviewDbUtil
- java.lang.Object
-
- com.google.gerrit.reviewdb.server.ReviewDbUtil
-
public class ReviewDbUtil extends Object
Static utilities for ReviewDb types.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkColumns(Class<?> clazz, Integer... expected)
static <K extends com.google.gwtorm.client.IntKey<?>>
com.google.common.collect.Ordering<K>intKeyOrdering()
Null-safe ordering over arbitrary subclass ofIntKey
.static ReviewDb
unwrapDb(ReviewDb db)
-
-
-
Method Detail
-
intKeyOrdering
public static <K extends com.google.gwtorm.client.IntKey<?>> com.google.common.collect.Ordering<K> intKeyOrdering()
Null-safe ordering over arbitrary subclass ofIntKey
.In some cases,
Comparator.comparing(Change.Id::get)
may be shorter and cleaner. However, this method may be preferable in some cases:- This ordering is null-safe over both input and the result of
IntKey.get()
;comparing
is only a good idea if all inputs are obviously non-null. intKeyOrdering().sortedCopy(iterable)
is shorter than the stream equivalent.- Creating derived comparators may be more readable with
Ordering
method chaining rather than staticComparator
methods.
- This ordering is null-safe over both input and the result of
-
-