Add method to convert a group reference into a configuration value

This remove the last use of GroupReference.PREFIX outside of
GroupReference class so make it private.

Change-Id: I6e7004b7f899f71227a3954b16f493f00423f190
This commit is contained in:
Hugo Arès
2017-06-19 11:28:36 -04:00
parent ea5e35c207
commit 5a95005979
2 changed files with 6 additions and 3 deletions

View File

@@ -20,7 +20,7 @@ import com.google.gerrit.reviewdb.client.AccountGroup;
/** Describes a group within a projects {@link AccessSection}s. */
public class GroupReference implements Comparable<GroupReference> {
public static final String PREFIX = "group ";
private static final String PREFIX = "group ";
/** @return a new reference to the given group description. */
public static GroupReference forGroup(AccountGroup group) {
@@ -94,6 +94,10 @@ public class GroupReference implements Comparable<GroupReference> {
return o instanceof GroupReference && compareTo((GroupReference) o) == 0;
}
public String toConfigValue() {
return PREFIX + name;
}
@Override
public String toString() {
return "Group[" + getName() + " / " + getUUID() + "]";

View File

@@ -204,8 +204,7 @@ public class PermissionRule implements Comparable<PermissionRule> {
r.append(' ');
}
r.append(GroupReference.PREFIX);
r.append(getGroup().getName());
r.append(getGroup().toConfigValue());
return r.toString();
}