Merge "Implement RevisionNote#getOnlyEntity"

This commit is contained in:
David Pursehouse 2019-02-26 14:25:03 +00:00 committed by Gerrit Code Review
commit 1ad4cf8fe3

@ -52,6 +52,13 @@ public abstract class RevisionNote<T> {
return raw;
}
@UsedAt(UsedAt.Project.PLUGIN_CHECKS)
public T getOnlyEntity() {
checkParsed();
checkState(entities.size() == 1, "expected exactly one entity");
return entities.get(0);
}
public ImmutableList<T> getEntities() {
checkParsed();
return entities;