Line data Source code
1 : // Copyright (C) 2016 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.server.project; 16 : 17 : import com.google.auto.value.AutoValue; 18 : 19 : /** 20 : * Stable identifier for options passed to a particular submit rule evaluator. 21 : * 22 : * <p>Used to test whether it is ok to reuse a cached list of submit records. Does not include a 23 : * change or patch set ID; callers are responsible for checking those on their own. 24 : */ 25 : @AutoValue 26 155 : public abstract class SubmitRuleOptions { 27 155 : private static final SubmitRuleOptions defaults = 28 155 : new AutoValue_SubmitRuleOptions.Builder().recomputeOnClosedChanges(false).build(); 29 : 30 : public static SubmitRuleOptions defaults() { 31 103 : return defaults; 32 : } 33 : 34 : public static Builder builder() { 35 155 : return defaults.toBuilder(); 36 : } 37 : 38 : /** 39 : * True if the submit rules should be recomputed even when the change is already closed (merged). 40 : */ 41 : public abstract boolean recomputeOnClosedChanges(); 42 : 43 : public abstract Builder toBuilder(); 44 : 45 : @AutoValue.Builder 46 155 : public abstract static class Builder { 47 : public abstract SubmitRuleOptions.Builder recomputeOnClosedChanges(boolean allowClosed); 48 : 49 : public abstract SubmitRuleOptions build(); 50 : } 51 : }