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