Don't use List in GerritConfigListener API

Currently GerritConfigListener's configUpdated method returns a List of
ConfigUpdatedEvent.Update.

There are only two types of updates (applied and rejected)
and the API returning lists of updates does not reflect this but
gives the impression that there can be an arbitrary amount
of update types.

Instead of returning a List of ConfigUpdatedEvent.Update that each have
a type, return a Multimap<UpdateResult, ConfigUpdateEntry>.

Removed the ConfigUpdatedEvent.Update class.

Change-Id: I81b4327a5878739087cd8a2ea8c0cff035b6ee57
This commit is contained in:
Rikard Almgren
2018-11-12 14:04:27 +01:00
parent 12f16056ca
commit 31300d71e3
9 changed files with 79 additions and 114 deletions

View File

@@ -15,13 +15,12 @@
package com.google.gerrit.server.config;
import com.google.common.collect.ImmutableSet;
import java.util.Collections;
public class GerritConfigListenerHelper {
public static GerritConfigListener acceptIfChanged(ConfigKey... keys) {
return e ->
e.isEntriesUpdated(ImmutableSet.copyOf(keys))
? Collections.singletonList(e.accept(ImmutableSet.copyOf(keys)))
: Collections.emptyList();
? e.accept(ImmutableSet.copyOf(keys))
: ConfigUpdatedEvent.NO_UPDATES;
}
}