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