• 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 rendering input data for an {@link IsolatedComputationHandler}.
28  *
29  * @hide
30  */
31 @DataClass(genBuilder = true, genEqualsHashCode = true)
32 public final class RenderInput implements Parcelable {
33     /** Properties of the slot to be rendered in. */
34     @Nullable SlotInfo mSlotInfo = null;
35 
36     /** A List of Bid Keys to be rendered. Keys must be present in REMOTE_DATA. */
37     @Nullable List<String> mBidKeys = null;
38 
39 
40 
41     // Code below generated by codegen v1.0.23.
42     //
43     // DO NOT MODIFY!
44     // CHECKSTYLE:OFF Generated code
45     //
46     // To regenerate run:
47     // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/ondevicepersonalization/RenderInput.java
48     //
49     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
50     //   Settings > Editor > Code Style > Formatter Control
51     //@formatter:off
52 
53 
54     @DataClass.Generated.Member
RenderInput( @ullable SlotInfo slotInfo, @Nullable List<String> bidKeys)55     /* package-private */ RenderInput(
56             @Nullable SlotInfo slotInfo,
57             @Nullable List<String> bidKeys) {
58         this.mSlotInfo = slotInfo;
59         this.mBidKeys = bidKeys;
60 
61         // onConstructed(); // You can define this method to get a callback
62     }
63 
64     /**
65      * Properties of the slot to be rendered in.
66      */
67     @DataClass.Generated.Member
getSlotInfo()68     public @Nullable SlotInfo getSlotInfo() {
69         return mSlotInfo;
70     }
71 
72     /**
73      * A List of Bid Keys to be rendered. Keys must be present in REMOTE_DATA.
74      */
75     @DataClass.Generated.Member
getBidKeys()76     public @Nullable List<String> getBidKeys() {
77         return mBidKeys;
78     }
79 
80     @Override
81     @DataClass.Generated.Member
equals(@ullable Object o)82     public boolean equals(@Nullable Object o) {
83         // You can override field equality logic by defining either of the methods like:
84         // boolean fieldNameEquals(RenderInput other) { ... }
85         // boolean fieldNameEquals(FieldType otherValue) { ... }
86 
87         if (this == o) return true;
88         if (o == null || getClass() != o.getClass()) return false;
89         @SuppressWarnings("unchecked")
90         RenderInput that = (RenderInput) o;
91         //noinspection PointlessBooleanExpression
92         return true
93                 && java.util.Objects.equals(mSlotInfo, that.mSlotInfo)
94                 && java.util.Objects.equals(mBidKeys, that.mBidKeys);
95     }
96 
97     @Override
98     @DataClass.Generated.Member
hashCode()99     public int hashCode() {
100         // You can override field hashCode logic by defining methods like:
101         // int fieldNameHashCode() { ... }
102 
103         int _hash = 1;
104         _hash = 31 * _hash + java.util.Objects.hashCode(mSlotInfo);
105         _hash = 31 * _hash + java.util.Objects.hashCode(mBidKeys);
106         return _hash;
107     }
108 
109     @Override
110     @DataClass.Generated.Member
writeToParcel(@ndroid.annotation.NonNull android.os.Parcel dest, int flags)111     public void writeToParcel(@android.annotation.NonNull android.os.Parcel dest, int flags) {
112         // You can override field parcelling by defining methods like:
113         // void parcelFieldName(Parcel dest, int flags) { ... }
114 
115         byte flg = 0;
116         if (mSlotInfo != null) flg |= 0x1;
117         if (mBidKeys != null) flg |= 0x2;
118         dest.writeByte(flg);
119         if (mSlotInfo != null) dest.writeTypedObject(mSlotInfo, flags);
120         if (mBidKeys != null) dest.writeStringList(mBidKeys);
121     }
122 
123     @Override
124     @DataClass.Generated.Member
describeContents()125     public int describeContents() { return 0; }
126 
127     /** @hide */
128     @SuppressWarnings({"unchecked", "RedundantCast"})
129     @DataClass.Generated.Member
RenderInput(@ndroid.annotation.NonNull android.os.Parcel in)130     /* package-private */ RenderInput(@android.annotation.NonNull android.os.Parcel in) {
131         // You can override field unparcelling by defining methods like:
132         // static FieldType unparcelFieldName(Parcel in) { ... }
133 
134         byte flg = in.readByte();
135         SlotInfo slotInfo = (flg & 0x1) == 0 ? null : (SlotInfo) in.readTypedObject(SlotInfo.CREATOR);
136         List<String> bidKeys = null;
137         if ((flg & 0x2) != 0) {
138             bidKeys = new java.util.ArrayList<>();
139             in.readStringList(bidKeys);
140         }
141 
142         this.mSlotInfo = slotInfo;
143         this.mBidKeys = bidKeys;
144 
145         // onConstructed(); // You can define this method to get a callback
146     }
147 
148     @DataClass.Generated.Member
149     public static final @android.annotation.NonNull Parcelable.Creator<RenderInput> CREATOR
150             = new Parcelable.Creator<RenderInput>() {
151         @Override
152         public RenderInput[] newArray(int size) {
153             return new RenderInput[size];
154         }
155 
156         @Override
157         public RenderInput createFromParcel(@android.annotation.NonNull android.os.Parcel in) {
158             return new RenderInput(in);
159         }
160     };
161 
162     /**
163      * A builder for {@link RenderInput}
164      */
165     @SuppressWarnings("WeakerAccess")
166     @DataClass.Generated.Member
167     public static final class Builder {
168 
169         private @Nullable SlotInfo mSlotInfo;
170         private @Nullable List<String> mBidKeys;
171 
172         private long mBuilderFieldsSet = 0L;
173 
Builder()174         public Builder() {
175         }
176 
177         /**
178          * Properties of the slot to be rendered in.
179          */
180         @DataClass.Generated.Member
setSlotInfo(@ndroid.annotation.NonNull SlotInfo value)181         public @android.annotation.NonNull Builder setSlotInfo(@android.annotation.NonNull SlotInfo value) {
182             checkNotUsed();
183             mBuilderFieldsSet |= 0x1;
184             mSlotInfo = value;
185             return this;
186         }
187 
188         /**
189          * A List of Bid Keys to be rendered. Keys must be present in REMOTE_DATA.
190          */
191         @DataClass.Generated.Member
setBidKeys(@ndroid.annotation.NonNull List<String> value)192         public @android.annotation.NonNull Builder setBidKeys(@android.annotation.NonNull List<String> value) {
193             checkNotUsed();
194             mBuilderFieldsSet |= 0x2;
195             mBidKeys = value;
196             return this;
197         }
198 
199         /** @see #setBidKeys */
200         @DataClass.Generated.Member
addBidKeys(@ndroid.annotation.NonNull String value)201         public @android.annotation.NonNull Builder addBidKeys(@android.annotation.NonNull String value) {
202             // You can refine this method's name by providing item's singular name, e.g.:
203             // @DataClass.PluralOf("item")) mItems = ...
204 
205             if (mBidKeys == null) setBidKeys(new java.util.ArrayList<>());
206             mBidKeys.add(value);
207             return this;
208         }
209 
210         /** Builds the instance. This builder should not be touched after calling this! */
build()211         public @android.annotation.NonNull RenderInput build() {
212             checkNotUsed();
213             mBuilderFieldsSet |= 0x4; // Mark builder used
214 
215             if ((mBuilderFieldsSet & 0x1) == 0) {
216                 mSlotInfo = null;
217             }
218             if ((mBuilderFieldsSet & 0x2) == 0) {
219                 mBidKeys = null;
220             }
221             RenderInput o = new RenderInput(
222                     mSlotInfo,
223                     mBidKeys);
224             return o;
225         }
226 
checkNotUsed()227         private void checkNotUsed() {
228             if ((mBuilderFieldsSet & 0x4) != 0) {
229                 throw new IllegalStateException(
230                         "This Builder should not be reused. Use a new Builder instance instead");
231             }
232         }
233     }
234 
235     @DataClass.Generated(
236             time = 1681848000397L,
237             codegenVersion = "1.0.23",
238             sourceFile = "packages/modules/OnDevicePersonalization/framework/java/android/ondevicepersonalization/RenderInput.java",
239             inputSignatures = " @android.annotation.Nullable android.ondevicepersonalization.SlotInfo mSlotInfo\n @android.annotation.Nullable java.util.List<java.lang.String> mBidKeys\nclass RenderInput extends java.lang.Object implements [android.os.Parcelable]\n@com.android.ondevicepersonalization.internal.util.DataClass(genBuilder=true, genEqualsHashCode=true)")
240     @Deprecated
__metadata()241     private void __metadata() {}
242 
243 
244     //@formatter:on
245     // End of generated code
246 
247 }
248