• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
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 
17 package android.ondevicepersonalization;
18 
19 import android.annotation.Nullable;
20 import android.os.Parcelable;
21 
22 import com.android.ondevicepersonalization.internal.util.DataClass;
23 
24 import java.util.List;
25 
26 /**
27  * The result of the download post-processing task.
28  *
29  * @hide
30  */
31 @DataClass(genBuilder = true, genEqualsHashCode = true)
32 public final class DownloadOutput implements Parcelable {
33     /** The keys to be retained in the REMOTE_DATA table. */
34     @Nullable private List<String> mKeysToRetain = null;
35 
36 
37 
38     // Code below generated by codegen v1.0.23.
39     //
40     // DO NOT MODIFY!
41     // CHECKSTYLE:OFF Generated code
42     //
43     // To regenerate run:
44     // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/ondevicepersonalization/DownloadOutput.java
45     //
46     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
47     //   Settings > Editor > Code Style > Formatter Control
48     //@formatter:off
49 
50 
51     @DataClass.Generated.Member
DownloadOutput( @ullable List<String> keysToRetain)52     /* package-private */ DownloadOutput(
53             @Nullable List<String> keysToRetain) {
54         this.mKeysToRetain = keysToRetain;
55 
56         // onConstructed(); // You can define this method to get a callback
57     }
58 
59     /**
60      * The keys to be retained in the REMOTE_DATA table.
61      */
62     @DataClass.Generated.Member
getKeysToRetain()63     public @Nullable List<String> getKeysToRetain() {
64         return mKeysToRetain;
65     }
66 
67     @Override
68     @DataClass.Generated.Member
equals(@ullable Object o)69     public boolean equals(@Nullable Object o) {
70         // You can override field equality logic by defining either of the methods like:
71         // boolean fieldNameEquals(DownloadOutput other) { ... }
72         // boolean fieldNameEquals(FieldType otherValue) { ... }
73 
74         if (this == o) return true;
75         if (o == null || getClass() != o.getClass()) return false;
76         @SuppressWarnings("unchecked")
77         DownloadOutput that = (DownloadOutput) o;
78         //noinspection PointlessBooleanExpression
79         return true
80                 && java.util.Objects.equals(mKeysToRetain, that.mKeysToRetain);
81     }
82 
83     @Override
84     @DataClass.Generated.Member
hashCode()85     public int hashCode() {
86         // You can override field hashCode logic by defining methods like:
87         // int fieldNameHashCode() { ... }
88 
89         int _hash = 1;
90         _hash = 31 * _hash + java.util.Objects.hashCode(mKeysToRetain);
91         return _hash;
92     }
93 
94     @Override
95     @DataClass.Generated.Member
writeToParcel(@ndroid.annotation.NonNull android.os.Parcel dest, int flags)96     public void writeToParcel(@android.annotation.NonNull android.os.Parcel dest, int flags) {
97         // You can override field parcelling by defining methods like:
98         // void parcelFieldName(Parcel dest, int flags) { ... }
99 
100         byte flg = 0;
101         if (mKeysToRetain != null) flg |= 0x1;
102         dest.writeByte(flg);
103         if (mKeysToRetain != null) dest.writeStringList(mKeysToRetain);
104     }
105 
106     @Override
107     @DataClass.Generated.Member
describeContents()108     public int describeContents() { return 0; }
109 
110     /** @hide */
111     @SuppressWarnings({"unchecked", "RedundantCast"})
112     @DataClass.Generated.Member
DownloadOutput(@ndroid.annotation.NonNull android.os.Parcel in)113     /* package-private */ DownloadOutput(@android.annotation.NonNull android.os.Parcel in) {
114         // You can override field unparcelling by defining methods like:
115         // static FieldType unparcelFieldName(Parcel in) { ... }
116 
117         byte flg = in.readByte();
118         List<String> keysToRetain = null;
119         if ((flg & 0x1) != 0) {
120             keysToRetain = new java.util.ArrayList<>();
121             in.readStringList(keysToRetain);
122         }
123 
124         this.mKeysToRetain = keysToRetain;
125 
126         // onConstructed(); // You can define this method to get a callback
127     }
128 
129     @DataClass.Generated.Member
130     public static final @android.annotation.NonNull Parcelable.Creator<DownloadOutput> CREATOR
131             = new Parcelable.Creator<DownloadOutput>() {
132         @Override
133         public DownloadOutput[] newArray(int size) {
134             return new DownloadOutput[size];
135         }
136 
137         @Override
138         public DownloadOutput createFromParcel(@android.annotation.NonNull android.os.Parcel in) {
139             return new DownloadOutput(in);
140         }
141     };
142 
143     /**
144      * A builder for {@link DownloadOutput}
145      */
146     @SuppressWarnings("WeakerAccess")
147     @DataClass.Generated.Member
148     public static final class Builder {
149 
150         private @Nullable List<String> mKeysToRetain;
151 
152         private long mBuilderFieldsSet = 0L;
153 
Builder()154         public Builder() {
155         }
156 
157         /**
158          * The keys to be retained in the REMOTE_DATA table.
159          */
160         @DataClass.Generated.Member
setKeysToRetain(@ndroid.annotation.NonNull List<String> value)161         public @android.annotation.NonNull Builder setKeysToRetain(@android.annotation.NonNull List<String> value) {
162             checkNotUsed();
163             mBuilderFieldsSet |= 0x1;
164             mKeysToRetain = value;
165             return this;
166         }
167 
168         /** @see #setKeysToRetain */
169         @DataClass.Generated.Member
addKeysToRetain(@ndroid.annotation.NonNull String value)170         public @android.annotation.NonNull Builder addKeysToRetain(@android.annotation.NonNull String value) {
171             // You can refine this method's name by providing item's singular name, e.g.:
172             // @DataClass.PluralOf("item")) mItems = ...
173 
174             if (mKeysToRetain == null) setKeysToRetain(new java.util.ArrayList<>());
175             mKeysToRetain.add(value);
176             return this;
177         }
178 
179         /** Builds the instance. This builder should not be touched after calling this! */
build()180         public @android.annotation.NonNull DownloadOutput build() {
181             checkNotUsed();
182             mBuilderFieldsSet |= 0x2; // Mark builder used
183 
184             if ((mBuilderFieldsSet & 0x1) == 0) {
185                 mKeysToRetain = null;
186             }
187             DownloadOutput o = new DownloadOutput(
188                     mKeysToRetain);
189             return o;
190         }
191 
checkNotUsed()192         private void checkNotUsed() {
193             if ((mBuilderFieldsSet & 0x2) != 0) {
194                 throw new IllegalStateException(
195                         "This Builder should not be reused. Use a new Builder instance instead");
196             }
197         }
198     }
199 
200     @DataClass.Generated(
201             time = 1680551322132L,
202             codegenVersion = "1.0.23",
203             sourceFile = "packages/modules/OnDevicePersonalization/framework/java/android/ondevicepersonalization/DownloadOutput.java",
204             inputSignatures = "private @android.annotation.Nullable java.util.List<java.lang.String> mKeysToRetain\nclass DownloadOutput extends java.lang.Object implements [android.os.Parcelable]\n@com.android.ondevicepersonalization.internal.util.DataClass(genBuilder=true, genEqualsHashCode=true)")
205     @Deprecated
__metadata()206     private void __metadata() {}
207 
208 
209     //@formatter:on
210     // End of generated code
211 
212 }
213