• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.google.android.libraries.mobiledatadownload.downloader;
17 
18 import com.google.auto.value.AutoValue;
19 import com.google.common.base.Optional;
20 
21 /** Response for checking content change. */
22 @AutoValue
23 public abstract class CheckContentChangeResponse {
24 
CheckContentChangeResponse()25   CheckContentChangeResponse() {}
26 
27   /** Whether or not the content is changed. */
contentChanged()28   public abstract boolean contentChanged();
29 
30   /**
31    * The optional fresh ETag that is being fetched from the url. When the value euquals {@link
32    * Optional#absent()}, it means that the target url does not support ETag.
33    */
freshETagOptional()34   public abstract Optional<String> freshETagOptional();
35 
newBuilder()36   public static Builder newBuilder() {
37     return new AutoValue_CheckContentChangeResponse.Builder();
38   }
39 
40   /** Builder for {@link CheckContentChangeResponse}. */
41   @AutoValue.Builder
42   public abstract static class Builder {
43 
Builder()44     Builder() {}
45 
46     /** Sets whether the content is changed, which is required. */
setContentChanged(boolean contentChanged)47     public abstract Builder setContentChanged(boolean contentChanged);
48 
49     /** Sets the fresh ETag. */
setFreshETagOptional(Optional<String> freshETagOptional)50     public abstract Builder setFreshETagOptional(Optional<String> freshETagOptional);
51 
build()52     public abstract CheckContentChangeResponse build();
53   }
54 }
55