|
15 | 15 | package com.google.firebase.appdistribution;
|
16 | 16 |
|
17 | 17 | import androidx.annotation.NonNull;
|
| 18 | +import androidx.annotation.Nullable; |
| 19 | +import com.google.auto.value.AutoValue; |
18 | 20 |
|
19 | 21 | /**
|
20 |
| - * Data class for AppDistributionRelease object returned by checkForUpdate() and |
| 22 | + * This class represents the AppDistributionRelease object returned by checkForUpdate() and |
21 | 23 | * updateToLatestRelease()
|
| 24 | + * |
| 25 | + * <p>It is an immutable value class implemented by AutoValue. |
| 26 | + * |
| 27 | + * @see <a |
| 28 | + * href="https://github.com/google/auto/tree/master/value">https://github.com/google/auto/tree/master/value</a> |
22 | 29 | */
|
23 |
| -public final class AppDistributionRelease { |
24 |
| - private final String displayVersion; |
25 |
| - private final String buildVersion; |
26 |
| - private final String releaseNotes; |
27 |
| - private final BinaryType binaryType; |
28 |
| - |
29 |
| - AppDistributionRelease( |
30 |
| - String displayVersion, String buildVersion, String releaseNotes, BinaryType binaryType) { |
31 |
| - this.displayVersion = displayVersion; |
32 |
| - this.buildVersion = buildVersion; |
33 |
| - this.releaseNotes = releaseNotes; |
34 |
| - this.binaryType = binaryType; |
| 30 | +@AutoValue |
| 31 | +public abstract class AppDistributionRelease { |
| 32 | + |
| 33 | + @NonNull |
| 34 | + public static Builder builder() { |
| 35 | + return new AutoValue_AppDistributionRelease.Builder(); |
35 | 36 | }
|
36 | 37 |
|
37 | 38 | /** The short bundle version of this build (example 1.0.0) */
|
38 | 39 | @NonNull
|
39 |
| - public String getDisplayVersion() { |
40 |
| - return displayVersion; |
41 |
| - } |
| 40 | + public abstract String getDisplayVersion(); |
42 | 41 |
|
43 | 42 | /** The bundle version of this build (example: 123) */
|
44 | 43 | @NonNull
|
45 |
| - public String getBuildVersion() { |
46 |
| - return buildVersion; |
47 |
| - } |
| 44 | + public abstract String getBuildVersion(); |
48 | 45 |
|
49 | 46 | /** The release notes for this build */
|
50 |
| - @NonNull |
51 |
| - public String getReleaseNotes() { |
52 |
| - return releaseNotes; |
53 |
| - } |
| 47 | + @Nullable |
| 48 | + public abstract String getReleaseNotes(); |
54 | 49 |
|
55 | 50 | /** The binary type for this build */
|
56 | 51 | @NonNull
|
57 |
| - public BinaryType getBinaryType() { |
58 |
| - return binaryType; |
| 52 | + public abstract BinaryType getBinaryType(); |
| 53 | + |
| 54 | + /** Builder for {@link AppDistributionRelease}. */ |
| 55 | + @AutoValue.Builder |
| 56 | + public abstract static class Builder { |
| 57 | + |
| 58 | + @NonNull |
| 59 | + public abstract Builder setDisplayVersion(@NonNull String value); |
| 60 | + |
| 61 | + @NonNull |
| 62 | + public abstract Builder setBuildVersion(@NonNull String value); |
| 63 | + |
| 64 | + @NonNull |
| 65 | + public abstract Builder setReleaseNotes(@Nullable String value); |
| 66 | + |
| 67 | + @NonNull |
| 68 | + public abstract Builder setBinaryType(@NonNull BinaryType value); |
| 69 | + |
| 70 | + @NonNull |
| 71 | + public abstract AppDistributionRelease build(); |
59 | 72 | }
|
60 | 73 | }
|
0 commit comments