Rework SUBM label in LabelId

Use a static method instead of a public LabelId field. LabelId is
mutable, so naming it like a constant is misleading at best. At worst,
a caller could call SUBMIT.set(newValue) and change the value seen by
all callers in the process. (Fortunately no callers were doing this as
far as I could tell.)

While we're in there, rename methods to refer to this as a "legacy"
submit label, as we want to eventually get rid of it in NoteDb.

Change-Id: Id7fbddfaac1d625839c66c73231d4e4ba2550c50
This commit is contained in:
Dave Borowitz
2016-03-08 10:01:49 -08:00
parent 6df8475ac5
commit 79ecc14466
14 changed files with 20 additions and 16 deletions

View File

@@ -20,7 +20,11 @@ import com.google.gwtorm.client.StringKey;
public class LabelId extends StringKey<com.google.gwtorm.client.Key<?>> {
private static final long serialVersionUID = 1L;
public static final LabelId SUBMIT = new LabelId("SUBM");
static final String LEGACY_SUBMIT_NAME = "SUBM";
public static LabelId legacySubmit() {
return new LabelId(LEGACY_SUBMIT_NAME);
}
@Column(id = 1)
public String id;

View File

@@ -149,8 +149,8 @@ public final class PatchSetApproval {
return getLabelId().get();
}
public boolean isSubmit() {
return LabelId.SUBMIT.get().equals(getLabel());
public boolean isLegacySubmit() {
return LabelId.LEGACY_SUBMIT_NAME.equals(getLabel());
}
@Override