Make ListOption#toHex generic so that this works for any list option

So far this method was only working for ListChangesOption, now we can
also use it for ListAccountsOption and ListGroupsOption.

This allows to remove the toHex method from the code-owners plugin which
needs this method for ListAccountsOption.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I7f373e70b643c9db843e75875f75723f30f4b03c
This commit is contained in:
Edwin Kempin
2020-06-22 14:47:00 +02:00
parent 0f8aebf7cd
commit 51462df870

View File

@@ -48,9 +48,9 @@ public interface ListOption {
return r;
}
static String toHex(Set<ListChangesOption> options) {
static <T extends Enum<T> & ListOption> String toHex(Set<T> options) {
int v = 0;
for (ListChangesOption option : options) {
for (T option : options) {
v |= 1 << option.getValue();
}