Make SubmitRule#evaluate return an Optional instead of a Collection

The original specification used a Collection so that a single SubmitRule
can return multiple SubmitRecords. The main use-case was inheritance and
being open to more future usages.

Looking at this today, this seems strange because a SubmitRecord keeps a
list of SubmitRequirements, so even if it is not allowed to return a
Collection, it can still contribute a number of SubmitRecords.

This does invalidate the original reasoning from using a Collection
which is why this commit replaces it with an Optional.

Change-Id: I0dce438504b30fe102f5b83af9f7976659f1fae8
This commit is contained in:
Patrick Hiesel
2019-08-13 15:29:27 +02:00
parent e7fc5ee635
commit 7ab1b18ef8
16 changed files with 115 additions and 137 deletions

View File

@@ -547,7 +547,7 @@ class RevisionApiImpl implements RevisionApi {
}
@Override
public List<TestSubmitRuleInfo> testSubmitRule(TestSubmitRuleInput in) throws RestApiException {
public TestSubmitRuleInfo testSubmitRule(TestSubmitRuleInput in) throws RestApiException {
try {
return testSubmitRule.get().apply(revision, in).value();
} catch (Exception e) {