Adapt to AccountState being an AutoValue
Change-Id: I500fd14b83beeb1cb77ef77acc667a1f4bce6a85
diff --git a/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java b/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java
index 9159bb0..dbf8310 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java
@@ -114,7 +114,7 @@
}
if (state.isPresent()) {
String name = nameOf(uuid, state.get());
- String email = Strings.emptyToNull(state.get().getAccount().preferredEmail());
+ String email = Strings.emptyToNull(state.get().account().preferredEmail());
return new GroupDescription.Basic() {
@Override
public AccountGroup.UUID getGroupUUID() {
@@ -157,7 +157,7 @@
private static GroupReference accountToGroup(AccountState s) {
AccountGroup.UUID uuid =
- s.getUserName().isPresent() ? uuid(s.getUserName().get()) : uuid(s.getAccount().id());
+ s.userName().isPresent() ? uuid(s.userName().get()) : uuid(s.account().id());
return new GroupReference(uuid, nameOf(uuid, s));
}
@@ -181,19 +181,19 @@
private static String nameOf(AccountGroup.UUID uuid, AccountState accountState) {
StringBuilder buf = new StringBuilder();
- if (accountState.getAccount().fullName() != null) {
- buf.append(accountState.getAccount().fullName());
+ if (accountState.account().fullName() != null) {
+ buf.append(accountState.account().fullName());
}
- if (accountState.getUserName().isPresent()) {
+ if (accountState.userName().isPresent()) {
if (buf.length() > 0) {
- buf.append(" (").append(accountState.getUserName().get()).append(")");
+ buf.append(" (").append(accountState.userName().get()).append(")");
} else {
- buf.append(accountState.getUserName().get());
+ buf.append(accountState.userName().get());
}
} else if (buf.length() > 0) {
- buf.append(" (").append(accountState.getAccount().id().get()).append(")");
+ buf.append(" (").append(accountState.account().id().get()).append(")");
} else {
- buf.append(accountState.getAccount().id().get());
+ buf.append(accountState.account().id().get());
}
String ident = username(uuid);