• 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.NonNull;
20 import android.os.Parcelable;
21 
22 import com.android.ondevicepersonalization.internal.util.AnnotationValidations;
23 import com.android.ondevicepersonalization.internal.util.DataClass;
24 
25 /**
26  * Values for OS versions.
27 *
28 * @hide
29 */
30 @DataClass(genBuilder = true, genEqualsHashCode = true)
31 public final class OSVersion implements Parcelable {
32     /** Major OS version. */
33     @NonNull int mMajor;
34 
35     /** Minor OS version. */
36     @NonNull int mMinor;
37 
38     /** Micro OS version. */
39     @NonNull int mMicro;
40 
41 
42 
43     // Code below generated by codegen v1.0.23.
44     //
45     // DO NOT MODIFY!
46     // CHECKSTYLE:OFF Generated code
47     //
48     // To regenerate run:
49     // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/ondevicepersonalization/OSVersion.java
50     //
51     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
52     //   Settings > Editor > Code Style > Formatter Control
53     //@formatter:off
54 
55 
56     @DataClass.Generated.Member
OSVersion( @onNull int major, @NonNull int minor, @NonNull int micro)57     /* package-private */ OSVersion(
58             @NonNull int major,
59             @NonNull int minor,
60             @NonNull int micro) {
61         this.mMajor = major;
62         AnnotationValidations.validate(
63                 NonNull.class, null, mMajor);
64         this.mMinor = minor;
65         AnnotationValidations.validate(
66                 NonNull.class, null, mMinor);
67         this.mMicro = micro;
68         AnnotationValidations.validate(
69                 NonNull.class, null, mMicro);
70 
71         // onConstructed(); // You can define this method to get a callback
72     }
73 
74     /**
75      * Major OS version.
76      */
77     @DataClass.Generated.Member
getMajor()78     public @NonNull int getMajor() {
79         return mMajor;
80     }
81 
82     /**
83      * Minor OS version.
84      */
85     @DataClass.Generated.Member
getMinor()86     public @NonNull int getMinor() {
87         return mMinor;
88     }
89 
90     /**
91      * Micro OS version.
92      */
93     @DataClass.Generated.Member
getMicro()94     public @NonNull int getMicro() {
95         return mMicro;
96     }
97 
98     @Override
99     @DataClass.Generated.Member
equals(@ndroid.annotation.Nullable Object o)100     public boolean equals(@android.annotation.Nullable Object o) {
101         // You can override field equality logic by defining either of the methods like:
102         // boolean fieldNameEquals(OSVersion other) { ... }
103         // boolean fieldNameEquals(FieldType otherValue) { ... }
104 
105         if (this == o) return true;
106         if (o == null || getClass() != o.getClass()) return false;
107         @SuppressWarnings("unchecked")
108         OSVersion that = (OSVersion) o;
109         //noinspection PointlessBooleanExpression
110         return true
111                 && mMajor == that.mMajor
112                 && mMinor == that.mMinor
113                 && mMicro == that.mMicro;
114     }
115 
116     @Override
117     @DataClass.Generated.Member
hashCode()118     public int hashCode() {
119         // You can override field hashCode logic by defining methods like:
120         // int fieldNameHashCode() { ... }
121 
122         int _hash = 1;
123         _hash = 31 * _hash + mMajor;
124         _hash = 31 * _hash + mMinor;
125         _hash = 31 * _hash + mMicro;
126         return _hash;
127     }
128 
129     @Override
130     @DataClass.Generated.Member
writeToParcel(@onNull android.os.Parcel dest, int flags)131     public void writeToParcel(@NonNull android.os.Parcel dest, int flags) {
132         // You can override field parcelling by defining methods like:
133         // void parcelFieldName(Parcel dest, int flags) { ... }
134 
135         dest.writeInt(mMajor);
136         dest.writeInt(mMinor);
137         dest.writeInt(mMicro);
138     }
139 
140     @Override
141     @DataClass.Generated.Member
describeContents()142     public int describeContents() { return 0; }
143 
144     /** @hide */
145     @SuppressWarnings({"unchecked", "RedundantCast"})
146     @DataClass.Generated.Member
OSVersion(@onNull android.os.Parcel in)147     /* package-private */ OSVersion(@NonNull android.os.Parcel in) {
148         // You can override field unparcelling by defining methods like:
149         // static FieldType unparcelFieldName(Parcel in) { ... }
150 
151         int major = in.readInt();
152         int minor = in.readInt();
153         int micro = in.readInt();
154 
155         this.mMajor = major;
156         AnnotationValidations.validate(
157                 NonNull.class, null, mMajor);
158         this.mMinor = minor;
159         AnnotationValidations.validate(
160                 NonNull.class, null, mMinor);
161         this.mMicro = micro;
162         AnnotationValidations.validate(
163                 NonNull.class, null, mMicro);
164 
165         // onConstructed(); // You can define this method to get a callback
166     }
167 
168     @DataClass.Generated.Member
169     public static final @NonNull Parcelable.Creator<OSVersion> CREATOR
170             = new Parcelable.Creator<OSVersion>() {
171         @Override
172         public OSVersion[] newArray(int size) {
173             return new OSVersion[size];
174         }
175 
176         @Override
177         public OSVersion createFromParcel(@NonNull android.os.Parcel in) {
178             return new OSVersion(in);
179         }
180     };
181 
182     /**
183      * A builder for {@link OSVersion}
184      */
185     @SuppressWarnings("WeakerAccess")
186     @DataClass.Generated.Member
187     public static final class Builder {
188 
189         private @NonNull int mMajor;
190         private @NonNull int mMinor;
191         private @NonNull int mMicro;
192 
193         private long mBuilderFieldsSet = 0L;
194 
195         /**
196          * Creates a new Builder.
197          *
198          * @param major
199          *   Major OS version.
200          * @param minor
201          *   Minor OS version.
202          * @param micro
203          *   Micro OS version.
204          */
Builder( @onNull int major, @NonNull int minor, @NonNull int micro)205         public Builder(
206                 @NonNull int major,
207                 @NonNull int minor,
208                 @NonNull int micro) {
209             mMajor = major;
210             AnnotationValidations.validate(
211                     NonNull.class, null, mMajor);
212             mMinor = minor;
213             AnnotationValidations.validate(
214                     NonNull.class, null, mMinor);
215             mMicro = micro;
216             AnnotationValidations.validate(
217                     NonNull.class, null, mMicro);
218         }
219 
Builder()220         public Builder() {
221         }
222 
223         /**
224          * Major OS version.
225          */
226         @DataClass.Generated.Member
setMajor(@onNull int value)227         public @NonNull Builder setMajor(@NonNull int value) {
228             checkNotUsed();
229             mBuilderFieldsSet |= 0x1;
230             mMajor = value;
231             return this;
232         }
233 
234         /**
235          * Minor OS version.
236          */
237         @DataClass.Generated.Member
setMinor(@onNull int value)238         public @NonNull Builder setMinor(@NonNull int value) {
239             checkNotUsed();
240             mBuilderFieldsSet |= 0x2;
241             mMinor = value;
242             return this;
243         }
244 
245         /**
246          * Micro OS version.
247          */
248         @DataClass.Generated.Member
setMicro(@onNull int value)249         public @NonNull Builder setMicro(@NonNull int value) {
250             checkNotUsed();
251             mBuilderFieldsSet |= 0x4;
252             mMicro = value;
253             return this;
254         }
255 
256         /** Builds the instance. This builder should not be touched after calling this! */
build()257         public @NonNull OSVersion build() {
258             checkNotUsed();
259             mBuilderFieldsSet |= 0x8; // Mark builder used
260 
261             OSVersion o = new OSVersion(
262                     mMajor,
263                     mMinor,
264                     mMicro);
265             return o;
266         }
267 
checkNotUsed()268         private void checkNotUsed() {
269             if ((mBuilderFieldsSet & 0x8) != 0) {
270                 throw new IllegalStateException(
271                         "This Builder should not be reused. Use a new Builder instance instead");
272             }
273         }
274     }
275 
276     @DataClass.Generated(
277             time = 1676500093560L,
278             codegenVersion = "1.0.23",
279             sourceFile = "packages/modules/OnDevicePersonalization/framework/java/android/ondevicepersonalization/OSVersion.java",
280             inputSignatures = " @android.annotation.NonNull int mMajor\n @android.annotation.NonNull int mMinor\n @android.annotation.NonNull int mMicro\nclass OSVersion extends java.lang.Object implements [android.os.Parcelable]\n@com.android.ondevicepersonalization.internal.util.DataClass(genBuilder=true, genEqualsHashCode=true)")
281     @Deprecated
__metadata()282     private void __metadata() {}
283 
284 
285     //@formatter:on
286     // End of generated code
287 
288 }
289