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