Line data Source code
1 : // Copyright (C) 2020 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.patch.filediff; 16 : 17 : import com.google.auto.value.AutoValue; 18 : import java.util.Optional; 19 : 20 : /** 21 : * An entity containing the four git diffs for a {@link FileDiffCacheKey}: 22 : * 23 : * <ol> 24 : * <li>The old vs. new commit 25 : * <li>The old commit vs. the old parent 26 : * <li>The new commit vs. the new parent 27 : * <li>The old parent vs. the new parent 28 : * </ol> 29 : */ 30 : @AutoValue 31 93 : abstract class AllFileGitDiffs { 32 : abstract AugmentedFileDiffCacheKey augmentedKey(); 33 : 34 : abstract GitDiffEntity mainDiff(); 35 : 36 : abstract Optional<GitDiffEntity> oldVsParentDiff(); 37 : 38 : abstract Optional<GitDiffEntity> newVsParentDiff(); 39 : 40 : abstract Optional<GitDiffEntity> parentVsParentDiff(); 41 : 42 : static AllFileGitDiffs.Builder builder() { 43 93 : return new AutoValue_AllFileGitDiffs.Builder(); 44 : } 45 : 46 : @AutoValue.Builder 47 93 : public abstract static class Builder { 48 : 49 : public abstract Builder augmentedKey(AugmentedFileDiffCacheKey value); 50 : 51 : public abstract Builder mainDiff(GitDiffEntity value); 52 : 53 : public abstract Builder oldVsParentDiff(Optional<GitDiffEntity> value); 54 : 55 : public abstract Builder newVsParentDiff(Optional<GitDiffEntity> value); 56 : 57 : public abstract Builder parentVsParentDiff(Optional<GitDiffEntity> value); 58 : 59 : public abstract AllFileGitDiffs build(); 60 : } 61 : }