Convert Project.NameKey to an immutable type
Follows the pattern of other key type refactorings, adding a static factory method. However, unlike the other key types, this one can't be an @AutoValue, because it has other subclasses and specific requirements around the implementation of equals. So we're stuck with boilerplate; at least it's only one field. See I6982fb24 for context. Change-Id: Ic46c4a357f4ee77f18e54e87ca97af6e834834b6
This commit is contained in:
@@ -59,7 +59,7 @@ public class ChangeIdHandler extends OptionHandler<Change.Id> {
|
||||
|
||||
try {
|
||||
final Change.Key key = Change.Key.parse(tokens.get(2));
|
||||
final Project.NameKey project = new Project.NameKey(tokens.get(0));
|
||||
final Project.NameKey project = Project.nameKey(tokens.get(0));
|
||||
final Branch.NameKey branch = Branch.nameKey(project, tokens.get(1));
|
||||
for (ChangeData cd : queryProvider.get().byBranchKey(branch, key)) {
|
||||
setter.addValue(cd.getId());
|
||||
|
@@ -72,7 +72,7 @@ public class ProjectHandler extends OptionHandler<ProjectState> {
|
||||
}
|
||||
|
||||
String nameWithoutSuffix = ProjectUtil.stripGitSuffix(projectName);
|
||||
Project.NameKey nameKey = new Project.NameKey(nameWithoutSuffix);
|
||||
Project.NameKey nameKey = Project.nameKey(nameWithoutSuffix);
|
||||
|
||||
ProjectState state;
|
||||
try {
|
||||
|
Reference in New Issue
Block a user