SubmitRuleOptions: Remove separate defaults() static method
Nobody was calling builder(), and nobody should be using a builder that isn't initialized with the default values. Only have a single builder method exposed by this class, and call it builder(). Change-Id: I4bfe96942ebfa9a21c1618fe9e1eee23cff2979d
This commit is contained in:
@@ -112,7 +112,7 @@ import org.slf4j.LoggerFactory;
|
||||
public class MergeOp implements AutoCloseable {
|
||||
private static final Logger log = LoggerFactory.getLogger(MergeOp.class);
|
||||
|
||||
private static final SubmitRuleOptions SUBMIT_RULE_OPTIONS = SubmitRuleOptions.defaults().build();
|
||||
private static final SubmitRuleOptions SUBMIT_RULE_OPTIONS = SubmitRuleOptions.builder().build();
|
||||
private static final SubmitRuleOptions SUBMIT_RULE_OPTIONS_ALLOW_CLOSED =
|
||||
SUBMIT_RULE_OPTIONS.toBuilder().allowClosed(true).build();
|
||||
|
||||
|
||||
@@ -563,10 +563,10 @@ public class ChangeField {
|
||||
});
|
||||
|
||||
public static final SubmitRuleOptions SUBMIT_RULE_OPTIONS_LENIENT =
|
||||
SubmitRuleOptions.defaults().allowClosed(true).build();
|
||||
SubmitRuleOptions.builder().allowClosed(true).build();
|
||||
|
||||
public static final SubmitRuleOptions SUBMIT_RULE_OPTIONS_STRICT =
|
||||
SubmitRuleOptions.defaults().build();
|
||||
SubmitRuleOptions.builder().build();
|
||||
|
||||
/**
|
||||
* JSON type for storing SubmitRecords.
|
||||
|
||||
@@ -97,7 +97,7 @@ public class SubmitRuleEvaluator {
|
||||
private final ProjectCache projectCache;
|
||||
private final ChangeData cd;
|
||||
|
||||
private SubmitRuleOptions.Builder optsBuilder = SubmitRuleOptions.defaults();
|
||||
private SubmitRuleOptions.Builder optsBuilder = SubmitRuleOptions.builder();
|
||||
private SubmitRuleOptions opts;
|
||||
private Change change;
|
||||
private CurrentUser user;
|
||||
@@ -142,7 +142,7 @@ public class SubmitRuleEvaluator {
|
||||
if (opts != null) {
|
||||
optsBuilder = opts.toBuilder();
|
||||
} else {
|
||||
optsBuilder = SubmitRuleOptions.defaults();
|
||||
optsBuilder = SubmitRuleOptions.builder();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,10 @@ import com.google.gerrit.common.Nullable;
|
||||
@AutoValue
|
||||
public abstract class SubmitRuleOptions {
|
||||
public static Builder builder() {
|
||||
return new AutoValue_SubmitRuleOptions.Builder();
|
||||
}
|
||||
|
||||
public static Builder defaults() {
|
||||
return builder().allowClosed(false).skipFilters(false).rule(null);
|
||||
return new AutoValue_SubmitRuleOptions.Builder()
|
||||
.allowClosed(false)
|
||||
.skipFilters(false)
|
||||
.rule(null);
|
||||
}
|
||||
|
||||
public abstract boolean allowClosed();
|
||||
|
||||
Reference in New Issue
Block a user