1 /*
2  * Copyright (C) 2019 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 package com.android.codegentest;
17 
18 import android.annotation.FloatRange;
19 import android.annotation.IntDef;
20 import android.annotation.NonNull;
21 import android.annotation.Nullable;
22 import android.annotation.Size;
23 import android.annotation.StringDef;
24 import android.annotation.StringRes;
25 import android.annotation.UserIdInt;
26 import android.net.LinkAddress;
27 import android.os.Parcel;
28 import android.os.Parcelable;
29 import android.view.accessibility.AccessibilityNodeInfo;
30 
31 import com.android.internal.util.AnnotationValidations;
32 import com.android.internal.util.DataClass;
33 import com.android.internal.util.DataClass.Each;
34 import com.android.internal.util.Parcelling;
35 import com.android.internal.util.Preconditions;
36 
37 import java.io.PrintWriter;
38 import java.util.ArrayList;
39 import java.util.Date;
40 import java.util.List;
41 import java.util.Objects;
42 import java.util.regex.Pattern;
43 
44 /**
45  * Sample data class, showing off various code generation features.
46  *
47  * See javadoc on non-generated code for the explanation of the various features.
48  *
49  * See {@link SampleDataClassTest} for various invariants the generated code is expected to hold.
50  */
51 @DataClass(
52 //        genParcelable = true, // implied by `implements Parcelable`
53 //        genAidl = true,       // implied by `implements Parcelable`
54 //        genGetters = true,    // on by default
55 //        genConstDefs = true,  // implied by presence of constants with common prefix
56         genBuilder = true,      // on by default if optional fields present, but suppressed by
57                                 // genConstructor
58         genConstructor = true,  // on by default but normally suppressed by genBuilder
59         genEqualsHashCode = true,
60         genToString = true,
61         genForEachField = true,
62         genSetters = true
63 )
64 public final class SampleDataClass implements Parcelable {
65 
66     /**
67      * For any group of {@link int} or {@link String} constants like these, a corresponding
68      * {@link IntDef}/{@link StringDef} will get generated, with name based on common prefix
69      * by default.
70      *
71      * When {@link #SampleDataClass constructing} an instance, fields annotated with these
72      * annotations get automatically validated, with only provided constants being a valid value.
73      *
74      * @see StateName, the generated {@link StringDef}
75      * @see #mStateName annotated with {@link StateName}
76      */
77     public static final String STATE_NAME_UNDEFINED = "?";
78     public static final String STATE_NAME_ON = "on";
79     public static final String STATE_NAME_OFF = "off";
80 
81     /**
82      * Additionally, for any generated {@link IntDef} a corresponding static
83      * *ToString method will be also generated, and used in {@link #toString()}.
84      *
85      * @see #stateToString(int)
86      * @see #toString()
87      * @see State
88      */
89     public static final int STATE_UNDEFINED = -1;
90     public static final int STATE_ON = 1;
91     public static final int STATE_OFF = 0;
92 
93     /**
94      * {@link IntDef}s with values specified in hex("0x...") are considered to be
95      * {@link IntDef#flag flags}, while ones specified with regular int literals are considered
96      * not to be flags.
97      *
98      * This affects their string representation, e.g. see the difference in
99      * {@link #requestFlagsToString} vs {@link #stateToString}.
100      *
101      * This also affects the validation logic when {@link #SampleDataClass constructing}
102      * an instance, with any flag combination("|") being valid.
103      *
104      * You can customize the name of the generated {@link IntDef}/{@link StringDef} annotation
105      * by annotating each constant with the desired name before running the generation.
106      *
107      * Here the annotation is named {@link RequestFlags} instead of the default {@code Flags}.
108      */
109     public static final @RequestFlags int FLAG_MANUAL_REQUEST = 0x1;
110     public static final @RequestFlags int FLAG_COMPATIBILITY_MODE_REQUEST = 0x2;
111     public static final @RequestFlags int FLAG_AUGMENTED_REQUEST = 0x80000000;
112 
113 
114     /**
115      * Any property javadoc should go onto the field, and will be copied where appropriate,
116      * including getters, constructor parameters, builder setters, etc.
117      *
118      * <p>
119      * This allows to avoid the burden of maintaining copies of the same documentation
120      * pieces in multiple places for each field.
121      */
122     private int mNum;
123     /**
124      * Various javadoc features should work as expected when copied, e.g {@code code},
125      * {@link #mName links}, <a href="https://google.com">html links</a>, etc.
126      *
127      * @see #mNum2 ..and so should blocks at the bottom, e.g. {@code @see} blocks.
128      */
129     private int mNum2;
130     /**
131      * {@code @hide} javadoc annotation is also propagated, which can be used to adjust the
132      * desired public API surface.
133      *
134      * @see #getNum4() is hidden
135      * @see Builder#setNum4(int) also hidden
136      * @hide
137      */
138     private int mNum4;
139 
140     /**
141      * {@link Nullable} or {@link NonNull} annotation is required on all non-primitive fields.
142      */
143     private @Nullable String mName;
144     /**
145      * Fields with default value expressions ("mFoo = ...") are optional, and are automatically
146      * initialized to the provided default expression, unless explicitly set.
147      *
148      * When using a {@link Builder} optional fields are passed via a {@link Builder#setName2 setter}
149      * while mandatory fields are passed via {@link Builder#Builder constructor}.
150      */
151     private @NonNull String mName2 = "Bob";
152     /**
153      * Alternatively, when default value computation is expensive,
154      * {@link #defaultName4 defaultFieldName()} can be defined to compute the default value.
155      */
156     private @NonNull String mName4;
157     private static String defaultName4() {
158         // Expensive computation
159         return "Bob4";
160     }
161 
162     /**
163      * For parcelling, any field type supported by {@link Parcel} is supported out of the box.
164      * E.g. {@link Parcelable} subclasses, {@link String}, {@link int}, {@link boolean}, etc.
165      */
166     private @Nullable AccessibilityNodeInfo mOtherParcelable = null;
167     /**
168      * Additionally, support for parcelling other types can be added by implementing a
169      * {@link Parcelling}, and referencing it in the {@link DataClass.ParcelWith} field annotation.
170      *
171      * @see MyDateParcelling an example {@link Parcelling} implementation
172      */
173     @DataClass.ParcelWith(MyDateParcelling.class)
174     private @NonNull Date mDate = new Date(42 * 42);
175     /**
176      * If a {@link Parcelling} is fairly common, consider putting it in {@link Parcelling.BuiltIn}
177      * to encourage its reuse.
178      */
179     @DataClass.ParcelWith(Parcelling.BuiltIn.ForPattern.class)
180     private @NonNull Pattern mPattern = Pattern.compile("");
181 
182     /**
183      * For lists, when using a {@link Builder}, other than a regular
184      * {@link Builder#setLinkAddresses2(List) setter}, and additional
185      * {@link Builder#addLinkAddresses2(LinkAddress) add} method is generated for convenience.
186      */
187     private @NonNull List<LinkAddress> mLinkAddresses2 = new ArrayList<>();
188     /**
189      * For aesthetics, you may want to consider providing a singular version of the plural field
190      * name, which would be used for the {@link #mLinkAddresses2 above mentioned} "add" method.
191      *
192      * @see Builder#addLinkAddress(LinkAddress)
193      */
194     @DataClass.PluralOf("linkAddress")
195     private @NonNull ArrayList<LinkAddress> mLinkAddresses = new ArrayList<>();
196     /**
197      * For array fields, when using a {@link Builder}, vararg argument format is used for
198      * convenience.
199      *
200      * @see Builder#setLinkAddresses4(LinkAddress...)
201      */
202     private @Nullable LinkAddress[] mLinkAddresses4 = null;
203 
204     /**
205      * {@link IntDef}/{@link StringDef}-annotated fields propagate the annotation to
206      * getter/constructor/setter/builder parameters, making for a nicer api.
207      *
208      * @see #getStateName
209      * @see Builder#setStateName
210      */
211     private @StateName @NonNull String mStateName = STATE_NAME_UNDEFINED;
212     /**
213      * Fields annotated with {@link IntDef} annotations also get a proper {@link #toString()} value.
214      */
215     private @RequestFlags int mFlags;
216     /**
217      * Above is true for both {@link IntDef#flag flags} and enum-like {@link IntDef}s
218      */
219     private @State int mState = STATE_UNDEFINED;
220 
221 
222     /**
223      * Making a field public will suppress getter generation in favor of accessing it directly.
224      */
225     public @NonNull CharSequence charSeq = "";
226     /**
227      * Final fields suppress generating a setter (when setters are requested).
228      */
229     private final @Nullable LinkAddress[] mLinkAddresses5;
230     /**
231      * Transient fields are completely ignored and can be used for caching.
232      */
233     private transient LinkAddress[] mLinkAddresses6;
234     /**
235      * When using transient fields for caching it's often also a good idea to initialize them
236      * lazily.
237      *
238      * You can declare a special method like {@link #lazyInitTmpStorage()}, to let the
239      * {@link #getTmpStorage getter} lazily-initialize the value on demand.
240      */
241     transient int[] mTmpStorage;
242     private int[] lazyInitTmpStorage() {
243         return new int[100];
244     }
245 
246     /**
247      * Fields with certain annotations are automatically validated in constructor
248      *
249      * You can see overloads in {@link AnnotationValidations} for a list of currently
250      * supported ones.
251      *
252      * You can also extend support to your custom annotations by creating another corresponding
253      * overloads like
254      * {@link AnnotationValidations#validate(Class, UserIdInt, int)}.
255      *
256      * @see #SampleDataClass
257      */
258     private @StringRes int mStringRes = 0;
259     /**
260      * Validation annotations may also have parameters.
261      *
262      * Parameter values will be supplied to validation method as name-value pairs.
263      *
264      * @see AnnotationValidations#validate(Class, Size, int, String, int, String, int)
265      */
266     private @android.annotation.IntRange(from = 0, to = 6) int mDayOfWeek = 3;
267     /**
268      * Unnamed validation annotation parameter gets supplied to the validating method named as
269      * "value".
270      *
271      * Validation annotations following {@link Each} annotation, will be applied for each
272      * array/collection element instead.
273      *
274      * @see AnnotationValidations#validate(Class, Size, int, String, int)
275      */
276     @Size(2)
277     @NonNull
278     @Each @FloatRange(from = 0f)
279     private float[] mCoords = new float[] {0f, 0f};
280 
281 
282     /**
283      * Manually declaring any method that would otherwise be generated suppresses its generation,
284      * allowing for fine-grained overrides of the generated behavior.
285      */
286     public LinkAddress[] getLinkAddresses4() {
287         //Suppress autogen
288         return null;
289     }
290 
291     /**
292      * Additionally, some methods like {@link #equals}, {@link #hashCode}, {@link #toString},
293      * {@link #writeToParcel}, {@link Parcelable.Creator#createFromParcel} allow you to define
294      * special methods to override their behavior on a per-field basis.
295      *
296      * See the generateted methods' descriptions for the detailed instructions of what the method
297      * signatures for such methods are expected to be.
298      *
299      * Here we use this to "fix" {@link Pattern} not implementing equals/hashCode.
300      *
301      * @see #equals
302      * @see #hashCode
303      */
304     private boolean patternEquals(Pattern other) {
305         return Objects.equals(mPattern.pattern(), other.pattern());
306     }
307     private int patternHashCode() {
308         return Objects.hashCode(mPattern.pattern());
309     }
310 
311     /**
312      * Similarly, {@link #onConstructed()}, if defined, gets called at the end of constructing an
313      * instance.
314      *
315      * At this point all fields should be in place, so this is the right place to put any custom
316      * validation logic.
317      */
318     private void onConstructed() {
319         Preconditions.checkState(mNum2 == mNum4);
320     }
321 
322     /**
323      * {@link DataClass#genForEachField} can be used to generate a generic {@link #forEachField}
324      * utility, which can be used for various use-cases not covered out of the box.
325      * Callback passed to {@link #forEachField} will be called once per each property with its name
326      * and value.
327      *
328      * Here for example it's used to implement a typical dump method.
329      *
330      * Note that there are 2 {@link #forEachField} versions provided, one that treats each field
331      * value as an {@link Object}, thus boxing primitives if any, and one that additionally takes
332      * specialized callbacks for particular primitive field types used in given class.
333      *
334      * Some primitives like {@link Boolean}s and {@link Integer}s within [-128, 127] don't allocate
335      * when boxed, so it's up to you to decide which one to use for a given use-case.
336      */
337     public void dump(PrintWriter pw) {
338         forEachField((self, name, value) -> {
339             pw.append("  ").append(name).append(": ").append(String.valueOf(value)).append('\n');
340         });
341     }
342 
343 
344 
345     // Code below generated by codegen v1.0.15.
346     //
347     // DO NOT MODIFY!
348     // CHECKSTYLE:OFF Generated code
349     //
350     // To regenerate run:
351     // $ codegen $ANDROID_BUILD_TOP/frameworks/base/tests/Codegen/src/com/android/codegentest/SampleDataClass.java
352     //
353     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
354     //   Settings > Editor > Code Style > Formatter Control
355     //@formatter:off
356 
357 
358     @IntDef(prefix = "STATE_", value = {
359         STATE_UNDEFINED,
360         STATE_ON,
361         STATE_OFF
362     })
363     @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE)
364     @DataClass.Generated.Member
365     public @interface State {}
366 
367     @DataClass.Generated.Member
368     public static String stateToString(@State int value) {
369         switch (value) {
370             case STATE_UNDEFINED:
371                     return "STATE_UNDEFINED";
372             case STATE_ON:
373                     return "STATE_ON";
374             case STATE_OFF:
375                     return "STATE_OFF";
376             default: return Integer.toHexString(value);
377         }
378     }
379 
380     @IntDef(flag = true, prefix = "FLAG_", value = {
381         FLAG_MANUAL_REQUEST,
382         FLAG_COMPATIBILITY_MODE_REQUEST,
383         FLAG_AUGMENTED_REQUEST
384     })
385     @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE)
386     @DataClass.Generated.Member
387     public @interface RequestFlags {}
388 
389     @DataClass.Generated.Member
390     public static String requestFlagsToString(@RequestFlags int value) {
391         return com.android.internal.util.BitUtils.flagsToString(
392                 value, SampleDataClass::singleRequestFlagsToString);
393     }
394 
395     @DataClass.Generated.Member
396     static String singleRequestFlagsToString(@RequestFlags int value) {
397         switch (value) {
398             case FLAG_MANUAL_REQUEST:
399                     return "FLAG_MANUAL_REQUEST";
400             case FLAG_COMPATIBILITY_MODE_REQUEST:
401                     return "FLAG_COMPATIBILITY_MODE_REQUEST";
402             case FLAG_AUGMENTED_REQUEST:
403                     return "FLAG_AUGMENTED_REQUEST";
404             default: return Integer.toHexString(value);
405         }
406     }
407 
408     @StringDef(prefix = "STATE_NAME_", value = {
409         STATE_NAME_UNDEFINED,
410         STATE_NAME_ON,
411         STATE_NAME_OFF
412     })
413     @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE)
414     @DataClass.Generated.Member
415     public @interface StateName {}
416 
417     /**
418      * Creates a new SampleDataClass.
419      *
420      * @param num
421      *   Any property javadoc should go onto the field, and will be copied where appropriate,
422      *   including getters, constructor parameters, builder setters, etc.
423      *
424      *   <p>
425      *   This allows to avoid the burden of maintaining copies of the same documentation
426      *   pieces in multiple places for each field.
427      * @param num2
428      *   Various javadoc features should work as expected when copied, e.g {@code code},
429      *   {@link #mName links}, <a href="https://google.com">html links</a>, etc.
430      * @param num4
431      *   {@code @hide} javadoc annotation is also propagated, which can be used to adjust the
432      *   desired public API surface.
433      * @param name
434      *   {@link Nullable} or {@link NonNull} annotation is required on all non-primitive fields.
435      * @param name2
436      *   Fields with default value expressions ("mFoo = ...") are optional, and are automatically
437      *   initialized to the provided default expression, unless explicitly set.
438      *
439      *   When using a {@link Builder} optional fields are passed via a {@link Builder#setName2 setter}
440      *   while mandatory fields are passed via {@link Builder#Builder constructor}.
441      * @param name4
442      *   Alternatively, when default value computation is expensive,
443      *   {@link #defaultName4 defaultFieldName()} can be defined to compute the default value.
444      * @param otherParcelable
445      *   For parcelling, any field type supported by {@link Parcel} is supported out of the box.
446      *   E.g. {@link Parcelable} subclasses, {@link String}, {@link int}, {@link boolean}, etc.
447      * @param date
448      *   Additionally, support for parcelling other types can be added by implementing a
449      *   {@link Parcelling}, and referencing it in the {@link DataClass.ParcelWith} field annotation.
450      * @param pattern
451      *   If a {@link Parcelling} is fairly common, consider putting it in {@link Parcelling.BuiltIn}
452      *   to encourage its reuse.
453      * @param linkAddresses2
454      *   For lists, when using a {@link Builder}, other than a regular
455      *   {@link Builder#setLinkAddresses2(List) setter}, and additional
456      *   {@link Builder#addLinkAddresses2(LinkAddress) add} method is generated for convenience.
457      * @param linkAddresses
458      *   For aesthetics, you may want to consider providing a singular version of the plural field
459      *   name, which would be used for the {@link #mLinkAddresses2 above mentioned} "add" method.
460      * @param linkAddresses4
461      *   For array fields, when using a {@link Builder}, vararg argument format is used for
462      *   convenience.
463      * @param stateName
464      *   {@link IntDef}/{@link StringDef}-annotated fields propagate the annotation to
465      *   getter/constructor/setter/builder parameters, making for a nicer api.
466      * @param flags
467      *   Fields annotated with {@link IntDef} annotations also get a proper {@link #toString()} value.
468      * @param state
469      *   Above is true for both {@link IntDef#flag flags} and enum-like {@link IntDef}s
470      * @param charSeq
471      *   Making a field public will suppress getter generation in favor of accessing it directly.
472      * @param linkAddresses5
473      *   Final fields suppress generating a setter (when setters are requested).
474      * @param stringRes
475      *   Fields with certain annotations are automatically validated in constructor
476      *
477      *   You can see overloads in {@link AnnotationValidations} for a list of currently
478      *   supported ones.
479      *
480      *   You can also extend support to your custom annotations by creating another corresponding
481      *   overloads like
482      *   {@link AnnotationValidations#validate(Class, UserIdInt, int)}.
483      * @param dayOfWeek
484      *   Validation annotations may also have parameters.
485      *
486      *   Parameter values will be supplied to validation method as name-value pairs.
487      * @param coords
488      *   Unnamed validation annotation parameter gets supplied to the validating method named as
489      *   "value".
490      *
491      *   Validation annotations following {@link Each} annotation, will be applied for each
492      *   array/collection element instead.
493      */
494     @DataClass.Generated.Member
495     public SampleDataClass(
496             int num,
497             int num2,
498             int num4,
499             @Nullable String name,
500             @NonNull String name2,
501             @NonNull String name4,
502             @Nullable AccessibilityNodeInfo otherParcelable,
503             @NonNull Date date,
504             @NonNull Pattern pattern,
505             @NonNull List<LinkAddress> linkAddresses2,
506             @NonNull ArrayList<LinkAddress> linkAddresses,
507             @Nullable LinkAddress[] linkAddresses4,
508             @StateName @NonNull String stateName,
509             @RequestFlags int flags,
510             @State int state,
511             @NonNull CharSequence charSeq,
512             @Nullable LinkAddress[] linkAddresses5,
513             @StringRes int stringRes,
514             @android.annotation.IntRange(from = 0, to = 6) int dayOfWeek,
515             @Size(2) @NonNull @FloatRange(from = 0f) float[] coords) {
516         this.mNum = num;
517         this.mNum2 = num2;
518         this.mNum4 = num4;
519         this.mName = name;
520         this.mName2 = name2;
521         AnnotationValidations.validate(
522                 NonNull.class, null, mName2);
523         this.mName4 = name4;
524         AnnotationValidations.validate(
525                 NonNull.class, null, mName4);
526         this.mOtherParcelable = otherParcelable;
527         this.mDate = date;
528         AnnotationValidations.validate(
529                 NonNull.class, null, mDate);
530         this.mPattern = pattern;
531         AnnotationValidations.validate(
532                 NonNull.class, null, mPattern);
533         this.mLinkAddresses2 = linkAddresses2;
534         AnnotationValidations.validate(
535                 NonNull.class, null, mLinkAddresses2);
536         this.mLinkAddresses = linkAddresses;
537         AnnotationValidations.validate(
538                 NonNull.class, null, mLinkAddresses);
539         this.mLinkAddresses4 = linkAddresses4;
540         this.mStateName = stateName;
541 
542         if (!(Objects.equals(mStateName, STATE_NAME_UNDEFINED))
543                 && !(Objects.equals(mStateName, STATE_NAME_ON))
544                 && !(Objects.equals(mStateName, STATE_NAME_OFF))) {
545             throw new java.lang.IllegalArgumentException(
546                     "stateName was " + mStateName + " but must be one of: "
547                             + "STATE_NAME_UNDEFINED(" + STATE_NAME_UNDEFINED + "), "
548                             + "STATE_NAME_ON(" + STATE_NAME_ON + "), "
549                             + "STATE_NAME_OFF(" + STATE_NAME_OFF + ")");
550         }
551 
552         AnnotationValidations.validate(
553                 NonNull.class, null, mStateName);
554         this.mFlags = flags;
555 
556         Preconditions.checkFlagsArgument(
557                 mFlags,
558                 FLAG_MANUAL_REQUEST
559                         | FLAG_COMPATIBILITY_MODE_REQUEST
560                         | FLAG_AUGMENTED_REQUEST);
561         this.mState = state;
562 
563         if (!(mState == STATE_UNDEFINED)
564                 && !(mState == STATE_ON)
565                 && !(mState == STATE_OFF)) {
566             throw new java.lang.IllegalArgumentException(
567                     "state was " + mState + " but must be one of: "
568                             + "STATE_UNDEFINED(" + STATE_UNDEFINED + "), "
569                             + "STATE_ON(" + STATE_ON + "), "
570                             + "STATE_OFF(" + STATE_OFF + ")");
571         }
572 
573         this.charSeq = charSeq;
574         AnnotationValidations.validate(
575                 NonNull.class, null, charSeq);
576         this.mLinkAddresses5 = linkAddresses5;
577         this.mStringRes = stringRes;
578         AnnotationValidations.validate(
579                 StringRes.class, null, mStringRes);
580         this.mDayOfWeek = dayOfWeek;
581         AnnotationValidations.validate(
582                 android.annotation.IntRange.class, null, mDayOfWeek,
583                 "from", 0,
584                 "to", 6);
585         this.mCoords = coords;
586         AnnotationValidations.validate(
587                 Size.class, null, mCoords.length,
588                 "value", 2);
589         AnnotationValidations.validate(
590                 NonNull.class, null, mCoords);
591         int coordsSize = mCoords.length;
592         for (int i = 0; i < coordsSize; i++) {
593             AnnotationValidations.validate(
594                     FloatRange.class, null, mCoords[i],
595                     "from", 0f);
596         }
597 
598 
599         onConstructed();
600     }
601 
602     /**
603      * Any property javadoc should go onto the field, and will be copied where appropriate,
604      * including getters, constructor parameters, builder setters, etc.
605      *
606      * <p>
607      * This allows to avoid the burden of maintaining copies of the same documentation
608      * pieces in multiple places for each field.
609      */
610     @DataClass.Generated.Member
611     public int getNum() {
612         return mNum;
613     }
614 
615     /**
616      * Various javadoc features should work as expected when copied, e.g {@code code},
617      * {@link #mName links}, <a href="https://google.com">html links</a>, etc.
618      *
619      * @see #mNum2 ..and so should blocks at the bottom, e.g. {@code @see} blocks.
620      */
621     @DataClass.Generated.Member
622     public int getNum2() {
623         return mNum2;
624     }
625 
626     /**
627      * {@code @hide} javadoc annotation is also propagated, which can be used to adjust the
628      * desired public API surface.
629      *
630      * @see #getNum4() is hidden
631      * @see Builder#setNum4(int) also hidden
632      * @hide
633      */
634     @DataClass.Generated.Member
635     public int getNum4() {
636         return mNum4;
637     }
638 
639     /**
640      * {@link Nullable} or {@link NonNull} annotation is required on all non-primitive fields.
641      */
642     @DataClass.Generated.Member
643     public @Nullable String getName() {
644         return mName;
645     }
646 
647     /**
648      * Fields with default value expressions ("mFoo = ...") are optional, and are automatically
649      * initialized to the provided default expression, unless explicitly set.
650      *
651      * When using a {@link Builder} optional fields are passed via a {@link Builder#setName2 setter}
652      * while mandatory fields are passed via {@link Builder#Builder constructor}.
653      */
654     @DataClass.Generated.Member
655     public @NonNull String getName2() {
656         return mName2;
657     }
658 
659     /**
660      * Alternatively, when default value computation is expensive,
661      * {@link #defaultName4 defaultFieldName()} can be defined to compute the default value.
662      */
663     @DataClass.Generated.Member
664     public @NonNull String getName4() {
665         return mName4;
666     }
667 
668     /**
669      * For parcelling, any field type supported by {@link Parcel} is supported out of the box.
670      * E.g. {@link Parcelable} subclasses, {@link String}, {@link int}, {@link boolean}, etc.
671      */
672     @DataClass.Generated.Member
673     public @Nullable AccessibilityNodeInfo getOtherParcelable() {
674         return mOtherParcelable;
675     }
676 
677     /**
678      * Additionally, support for parcelling other types can be added by implementing a
679      * {@link Parcelling}, and referencing it in the {@link DataClass.ParcelWith} field annotation.
680      *
681      * @see MyDateParcelling an example {@link Parcelling} implementation
682      */
683     @DataClass.Generated.Member
684     public @NonNull Date getDate() {
685         return mDate;
686     }
687 
688     /**
689      * If a {@link Parcelling} is fairly common, consider putting it in {@link Parcelling.BuiltIn}
690      * to encourage its reuse.
691      */
692     @DataClass.Generated.Member
693     public @NonNull Pattern getPattern() {
694         return mPattern;
695     }
696 
697     /**
698      * For lists, when using a {@link Builder}, other than a regular
699      * {@link Builder#setLinkAddresses2(List) setter}, and additional
700      * {@link Builder#addLinkAddresses2(LinkAddress) add} method is generated for convenience.
701      */
702     @DataClass.Generated.Member
703     public @NonNull List<LinkAddress> getLinkAddresses2() {
704         return mLinkAddresses2;
705     }
706 
707     /**
708      * For aesthetics, you may want to consider providing a singular version of the plural field
709      * name, which would be used for the {@link #mLinkAddresses2 above mentioned} "add" method.
710      *
711      * @see Builder#addLinkAddress(LinkAddress)
712      */
713     @DataClass.Generated.Member
714     public @NonNull ArrayList<LinkAddress> getLinkAddresses() {
715         return mLinkAddresses;
716     }
717 
718     /**
719      * {@link IntDef}/{@link StringDef}-annotated fields propagate the annotation to
720      * getter/constructor/setter/builder parameters, making for a nicer api.
721      *
722      * @see #getStateName
723      * @see Builder#setStateName
724      */
725     @DataClass.Generated.Member
726     public @StateName @NonNull String getStateName() {
727         return mStateName;
728     }
729 
730     /**
731      * Fields annotated with {@link IntDef} annotations also get a proper {@link #toString()} value.
732      */
733     @DataClass.Generated.Member
734     public @RequestFlags int getFlags() {
735         return mFlags;
736     }
737 
738     /**
739      * Above is true for both {@link IntDef#flag flags} and enum-like {@link IntDef}s
740      */
741     @DataClass.Generated.Member
742     public @State int getState() {
743         return mState;
744     }
745 
746     /**
747      * Final fields suppress generating a setter (when setters are requested).
748      */
749     @DataClass.Generated.Member
750     public @Nullable LinkAddress[] getLinkAddresses5() {
751         return mLinkAddresses5;
752     }
753 
754     /**
755      * Fields with certain annotations are automatically validated in constructor
756      *
757      * You can see overloads in {@link AnnotationValidations} for a list of currently
758      * supported ones.
759      *
760      * You can also extend support to your custom annotations by creating another corresponding
761      * overloads like
762      * {@link AnnotationValidations#validate(Class, UserIdInt, int)}.
763      *
764      * @see #SampleDataClass
765      */
766     @DataClass.Generated.Member
767     public @StringRes int getStringRes() {
768         return mStringRes;
769     }
770 
771     /**
772      * Validation annotations may also have parameters.
773      *
774      * Parameter values will be supplied to validation method as name-value pairs.
775      *
776      * @see AnnotationValidations#validate(Class, Size, int, String, int, String, int)
777      */
778     @DataClass.Generated.Member
779     public @android.annotation.IntRange(from = 0, to = 6) int getDayOfWeek() {
780         return mDayOfWeek;
781     }
782 
783     /**
784      * Unnamed validation annotation parameter gets supplied to the validating method named as
785      * "value".
786      *
787      * Validation annotations following {@link Each} annotation, will be applied for each
788      * array/collection element instead.
789      *
790      * @see AnnotationValidations#validate(Class, Size, int, String, int)
791      */
792     @DataClass.Generated.Member
793     public @Size(2) @NonNull @FloatRange(from = 0f) float[] getCoords() {
794         return mCoords;
795     }
796 
797     /**
798      * When using transient fields for caching it's often also a good idea to initialize them
799      * lazily.
800      *
801      * You can declare a special method like {@link #lazyInitTmpStorage()}, to let the
802      * {@link #getTmpStorage getter} lazily-initialize the value on demand.
803      */
804     @DataClass.Generated.Member
805     public int[] getTmpStorage() {
806         int[] tmpStorage = mTmpStorage;
807         if (tmpStorage == null) {
808             // You can mark field as volatile for thread-safe double-check init
809             tmpStorage = mTmpStorage = lazyInitTmpStorage();
810         }
811         return tmpStorage;
812     }
813 
814     /**
815      * Any property javadoc should go onto the field, and will be copied where appropriate,
816      * including getters, constructor parameters, builder setters, etc.
817      *
818      * <p>
819      * This allows to avoid the burden of maintaining copies of the same documentation
820      * pieces in multiple places for each field.
821      */
822     @DataClass.Generated.Member
823     public SampleDataClass setNum( int value) {
824         mNum = value;
825         return this;
826     }
827 
828     /**
829      * Various javadoc features should work as expected when copied, e.g {@code code},
830      * {@link #mName links}, <a href="https://google.com">html links</a>, etc.
831      *
832      * @see #mNum2 ..and so should blocks at the bottom, e.g. {@code @see} blocks.
833      */
834     @DataClass.Generated.Member
835     public SampleDataClass setNum2( int value) {
836         mNum2 = value;
837         return this;
838     }
839 
840     /**
841      * {@code @hide} javadoc annotation is also propagated, which can be used to adjust the
842      * desired public API surface.
843      *
844      * @see #getNum4() is hidden
845      * @see Builder#setNum4(int) also hidden
846      * @hide
847      */
848     @DataClass.Generated.Member
849     public SampleDataClass setNum4( int value) {
850         mNum4 = value;
851         return this;
852     }
853 
854     /**
855      * {@link Nullable} or {@link NonNull} annotation is required on all non-primitive fields.
856      */
857     @DataClass.Generated.Member
858     public SampleDataClass setName(@NonNull String value) {
859         mName = value;
860         return this;
861     }
862 
863     /**
864      * Fields with default value expressions ("mFoo = ...") are optional, and are automatically
865      * initialized to the provided default expression, unless explicitly set.
866      *
867      * When using a {@link Builder} optional fields are passed via a {@link Builder#setName2 setter}
868      * while mandatory fields are passed via {@link Builder#Builder constructor}.
869      */
870     @DataClass.Generated.Member
871     public SampleDataClass setName2(@NonNull String value) {
872         mName2 = value;
873         AnnotationValidations.validate(
874                 NonNull.class, null, mName2);
875         return this;
876     }
877 
878     /**
879      * Alternatively, when default value computation is expensive,
880      * {@link #defaultName4 defaultFieldName()} can be defined to compute the default value.
881      */
882     @DataClass.Generated.Member
883     public SampleDataClass setName4(@NonNull String value) {
884         mName4 = value;
885         AnnotationValidations.validate(
886                 NonNull.class, null, mName4);
887         return this;
888     }
889 
890     /**
891      * For parcelling, any field type supported by {@link Parcel} is supported out of the box.
892      * E.g. {@link Parcelable} subclasses, {@link String}, {@link int}, {@link boolean}, etc.
893      */
894     @DataClass.Generated.Member
895     public SampleDataClass setOtherParcelable(@NonNull AccessibilityNodeInfo value) {
896         mOtherParcelable = value;
897         return this;
898     }
899 
900     /**
901      * Additionally, support for parcelling other types can be added by implementing a
902      * {@link Parcelling}, and referencing it in the {@link DataClass.ParcelWith} field annotation.
903      *
904      * @see MyDateParcelling an example {@link Parcelling} implementation
905      */
906     @DataClass.Generated.Member
907     public SampleDataClass setDate(@NonNull Date value) {
908         mDate = value;
909         AnnotationValidations.validate(
910                 NonNull.class, null, mDate);
911         return this;
912     }
913 
914     /**
915      * If a {@link Parcelling} is fairly common, consider putting it in {@link Parcelling.BuiltIn}
916      * to encourage its reuse.
917      */
918     @DataClass.Generated.Member
919     public SampleDataClass setPattern(@NonNull Pattern value) {
920         mPattern = value;
921         AnnotationValidations.validate(
922                 NonNull.class, null, mPattern);
923         return this;
924     }
925 
926     /**
927      * For lists, when using a {@link Builder}, other than a regular
928      * {@link Builder#setLinkAddresses2(List) setter}, and additional
929      * {@link Builder#addLinkAddresses2(LinkAddress) add} method is generated for convenience.
930      */
931     @DataClass.Generated.Member
932     public SampleDataClass setLinkAddresses2(@NonNull List<LinkAddress> value) {
933         mLinkAddresses2 = value;
934         AnnotationValidations.validate(
935                 NonNull.class, null, mLinkAddresses2);
936         return this;
937     }
938 
939     /**
940      * For aesthetics, you may want to consider providing a singular version of the plural field
941      * name, which would be used for the {@link #mLinkAddresses2 above mentioned} "add" method.
942      *
943      * @see Builder#addLinkAddress(LinkAddress)
944      */
945     @DataClass.Generated.Member
946     public SampleDataClass setLinkAddresses(@NonNull ArrayList<LinkAddress> value) {
947         mLinkAddresses = value;
948         AnnotationValidations.validate(
949                 NonNull.class, null, mLinkAddresses);
950         return this;
951     }
952 
953     /**
954      * For array fields, when using a {@link Builder}, vararg argument format is used for
955      * convenience.
956      *
957      * @see Builder#setLinkAddresses4(LinkAddress...)
958      */
959     @DataClass.Generated.Member
960     public SampleDataClass setLinkAddresses4(@NonNull LinkAddress... value) {
961         mLinkAddresses4 = value;
962         return this;
963     }
964 
965     /**
966      * {@link IntDef}/{@link StringDef}-annotated fields propagate the annotation to
967      * getter/constructor/setter/builder parameters, making for a nicer api.
968      *
969      * @see #getStateName
970      * @see Builder#setStateName
971      */
972     @DataClass.Generated.Member
973     public SampleDataClass setStateName(@StateName @NonNull String value) {
974         mStateName = value;
975 
976         if (!(Objects.equals(mStateName, STATE_NAME_UNDEFINED))
977                 && !(Objects.equals(mStateName, STATE_NAME_ON))
978                 && !(Objects.equals(mStateName, STATE_NAME_OFF))) {
979             throw new java.lang.IllegalArgumentException(
980                     "stateName was " + mStateName + " but must be one of: "
981                             + "STATE_NAME_UNDEFINED(" + STATE_NAME_UNDEFINED + "), "
982                             + "STATE_NAME_ON(" + STATE_NAME_ON + "), "
983                             + "STATE_NAME_OFF(" + STATE_NAME_OFF + ")");
984         }
985 
986         AnnotationValidations.validate(
987                 NonNull.class, null, mStateName);
988         return this;
989     }
990 
991     /**
992      * Fields annotated with {@link IntDef} annotations also get a proper {@link #toString()} value.
993      */
994     @DataClass.Generated.Member
995     public SampleDataClass setFlags(@RequestFlags int value) {
996         mFlags = value;
997 
998         Preconditions.checkFlagsArgument(
999                 mFlags,
1000                 FLAG_MANUAL_REQUEST
1001                         | FLAG_COMPATIBILITY_MODE_REQUEST
1002                         | FLAG_AUGMENTED_REQUEST);
1003         return this;
1004     }
1005 
1006     /**
1007      * Above is true for both {@link IntDef#flag flags} and enum-like {@link IntDef}s
1008      */
1009     @DataClass.Generated.Member
1010     public SampleDataClass setState(@State int value) {
1011         mState = value;
1012 
1013         if (!(mState == STATE_UNDEFINED)
1014                 && !(mState == STATE_ON)
1015                 && !(mState == STATE_OFF)) {
1016             throw new java.lang.IllegalArgumentException(
1017                     "state was " + mState + " but must be one of: "
1018                             + "STATE_UNDEFINED(" + STATE_UNDEFINED + "), "
1019                             + "STATE_ON(" + STATE_ON + "), "
1020                             + "STATE_OFF(" + STATE_OFF + ")");
1021         }
1022 
1023         return this;
1024     }
1025 
1026     /**
1027      * Fields with certain annotations are automatically validated in constructor
1028      *
1029      * You can see overloads in {@link AnnotationValidations} for a list of currently
1030      * supported ones.
1031      *
1032      * You can also extend support to your custom annotations by creating another corresponding
1033      * overloads like
1034      * {@link AnnotationValidations#validate(Class, UserIdInt, int)}.
1035      *
1036      * @see #SampleDataClass
1037      */
1038     @DataClass.Generated.Member
1039     public SampleDataClass setStringRes(@StringRes int value) {
1040         mStringRes = value;
1041         AnnotationValidations.validate(
1042                 StringRes.class, null, mStringRes);
1043         return this;
1044     }
1045 
1046     /**
1047      * Validation annotations may also have parameters.
1048      *
1049      * Parameter values will be supplied to validation method as name-value pairs.
1050      *
1051      * @see AnnotationValidations#validate(Class, Size, int, String, int, String, int)
1052      */
1053     @DataClass.Generated.Member
1054     public SampleDataClass setDayOfWeek(@android.annotation.IntRange(from = 0, to = 6) int value) {
1055         mDayOfWeek = value;
1056         AnnotationValidations.validate(
1057                 android.annotation.IntRange.class, null, mDayOfWeek,
1058                 "from", 0,
1059                 "to", 6);
1060         return this;
1061     }
1062 
1063     /**
1064      * Unnamed validation annotation parameter gets supplied to the validating method named as
1065      * "value".
1066      *
1067      * Validation annotations following {@link Each} annotation, will be applied for each
1068      * array/collection element instead.
1069      *
1070      * @see AnnotationValidations#validate(Class, Size, int, String, int)
1071      */
1072     @DataClass.Generated.Member
1073     public SampleDataClass setCoords(@Size(2) @NonNull @FloatRange(from = 0f) float... value) {
1074         mCoords = value;
1075         AnnotationValidations.validate(
1076                 Size.class, null, mCoords.length,
1077                 "value", 2);
1078         AnnotationValidations.validate(
1079                 NonNull.class, null, mCoords);
1080         int coordsSize = mCoords.length;
1081         for (int i = 0; i < coordsSize; i++) {
1082             AnnotationValidations.validate(
1083                     FloatRange.class, null, mCoords[i],
1084                     "from", 0f);
1085         }
1086 
1087         return this;
1088     }
1089 
1090     @Override
1091     @DataClass.Generated.Member
1092     public String toString() {
1093         // You can override field toString logic by defining methods like:
1094         // String fieldNameToString() { ... }
1095 
1096         return "SampleDataClass { " +
1097                 "num = " + mNum + ", " +
1098                 "num2 = " + mNum2 + ", " +
1099                 "num4 = " + mNum4 + ", " +
1100                 "name = " + mName + ", " +
1101                 "name2 = " + mName2 + ", " +
1102                 "name4 = " + mName4 + ", " +
1103                 "otherParcelable = " + mOtherParcelable + ", " +
1104                 "date = " + mDate + ", " +
1105                 "pattern = " + mPattern + ", " +
1106                 "linkAddresses2 = " + mLinkAddresses2 + ", " +
1107                 "linkAddresses = " + mLinkAddresses + ", " +
1108                 "linkAddresses4 = " + java.util.Arrays.toString(mLinkAddresses4) + ", " +
1109                 "stateName = " + mStateName + ", " +
1110                 "flags = " + requestFlagsToString(mFlags) + ", " +
1111                 "state = " + stateToString(mState) + ", " +
1112                 "charSeq = " + charSeq + ", " +
1113                 "linkAddresses5 = " + java.util.Arrays.toString(mLinkAddresses5) + ", " +
1114                 "stringRes = " + mStringRes + ", " +
1115                 "dayOfWeek = " + mDayOfWeek + ", " +
1116                 "coords = " + java.util.Arrays.toString(mCoords) +
1117         " }";
1118     }
1119 
1120     @Override
1121     @DataClass.Generated.Member
1122     public boolean equals(@Nullable Object o) {
1123         // You can override field equality logic by defining either of the methods like:
1124         // boolean fieldNameEquals(SampleDataClass other) { ... }
1125         // boolean fieldNameEquals(FieldType otherValue) { ... }
1126 
1127         if (this == o) return true;
1128         if (o == null || getClass() != o.getClass()) return false;
1129         @SuppressWarnings("unchecked")
1130         SampleDataClass that = (SampleDataClass) o;
1131         //noinspection PointlessBooleanExpression
1132         return true
1133                 && mNum == that.mNum
1134                 && mNum2 == that.mNum2
1135                 && mNum4 == that.mNum4
1136                 && Objects.equals(mName, that.mName)
1137                 && Objects.equals(mName2, that.mName2)
1138                 && Objects.equals(mName4, that.mName4)
1139                 && Objects.equals(mOtherParcelable, that.mOtherParcelable)
1140                 && Objects.equals(mDate, that.mDate)
1141                 && patternEquals(that.mPattern)
1142                 && Objects.equals(mLinkAddresses2, that.mLinkAddresses2)
1143                 && Objects.equals(mLinkAddresses, that.mLinkAddresses)
1144                 && java.util.Arrays.equals(mLinkAddresses4, that.mLinkAddresses4)
1145                 && Objects.equals(mStateName, that.mStateName)
1146                 && mFlags == that.mFlags
1147                 && mState == that.mState
1148                 && Objects.equals(charSeq, that.charSeq)
1149                 && java.util.Arrays.equals(mLinkAddresses5, that.mLinkAddresses5)
1150                 && mStringRes == that.mStringRes
1151                 && mDayOfWeek == that.mDayOfWeek
1152                 && java.util.Arrays.equals(mCoords, that.mCoords);
1153     }
1154 
1155     @Override
1156     @DataClass.Generated.Member
1157     public int hashCode() {
1158         // You can override field hashCode logic by defining methods like:
1159         // int fieldNameHashCode() { ... }
1160 
1161         int _hash = 1;
1162         _hash = 31 * _hash + mNum;
1163         _hash = 31 * _hash + mNum2;
1164         _hash = 31 * _hash + mNum4;
1165         _hash = 31 * _hash + Objects.hashCode(mName);
1166         _hash = 31 * _hash + Objects.hashCode(mName2);
1167         _hash = 31 * _hash + Objects.hashCode(mName4);
1168         _hash = 31 * _hash + Objects.hashCode(mOtherParcelable);
1169         _hash = 31 * _hash + Objects.hashCode(mDate);
1170         _hash = 31 * _hash + patternHashCode();
1171         _hash = 31 * _hash + Objects.hashCode(mLinkAddresses2);
1172         _hash = 31 * _hash + Objects.hashCode(mLinkAddresses);
1173         _hash = 31 * _hash + java.util.Arrays.hashCode(mLinkAddresses4);
1174         _hash = 31 * _hash + Objects.hashCode(mStateName);
1175         _hash = 31 * _hash + mFlags;
1176         _hash = 31 * _hash + mState;
1177         _hash = 31 * _hash + Objects.hashCode(charSeq);
1178         _hash = 31 * _hash + java.util.Arrays.hashCode(mLinkAddresses5);
1179         _hash = 31 * _hash + mStringRes;
1180         _hash = 31 * _hash + mDayOfWeek;
1181         _hash = 31 * _hash + java.util.Arrays.hashCode(mCoords);
1182         return _hash;
1183     }
1184 
1185     @DataClass.Generated.Member
1186     void forEachField(
1187             @NonNull DataClass.PerIntFieldAction<SampleDataClass> actionInt,
1188             @NonNull DataClass.PerObjectFieldAction<SampleDataClass> actionObject) {
1189         actionInt.acceptInt(this, "num", mNum);
1190         actionInt.acceptInt(this, "num2", mNum2);
1191         actionInt.acceptInt(this, "num4", mNum4);
1192         actionObject.acceptObject(this, "name", mName);
1193         actionObject.acceptObject(this, "name2", mName2);
1194         actionObject.acceptObject(this, "name4", mName4);
1195         actionObject.acceptObject(this, "otherParcelable", mOtherParcelable);
1196         actionObject.acceptObject(this, "date", mDate);
1197         actionObject.acceptObject(this, "pattern", mPattern);
1198         actionObject.acceptObject(this, "linkAddresses2", mLinkAddresses2);
1199         actionObject.acceptObject(this, "linkAddresses", mLinkAddresses);
1200         actionObject.acceptObject(this, "linkAddresses4", mLinkAddresses4);
1201         actionObject.acceptObject(this, "stateName", mStateName);
1202         actionInt.acceptInt(this, "flags", mFlags);
1203         actionInt.acceptInt(this, "state", mState);
1204         actionObject.acceptObject(this, "charSeq", charSeq);
1205         actionObject.acceptObject(this, "linkAddresses5", mLinkAddresses5);
1206         actionInt.acceptInt(this, "stringRes", mStringRes);
1207         actionInt.acceptInt(this, "dayOfWeek", mDayOfWeek);
1208         actionObject.acceptObject(this, "coords", mCoords);
1209     }
1210 
1211     /** @deprecated May cause boxing allocations - use with caution! */
1212     @Deprecated
1213     @DataClass.Generated.Member
1214     void forEachField(@NonNull DataClass.PerObjectFieldAction<SampleDataClass> action) {
1215         action.acceptObject(this, "num", mNum);
1216         action.acceptObject(this, "num2", mNum2);
1217         action.acceptObject(this, "num4", mNum4);
1218         action.acceptObject(this, "name", mName);
1219         action.acceptObject(this, "name2", mName2);
1220         action.acceptObject(this, "name4", mName4);
1221         action.acceptObject(this, "otherParcelable", mOtherParcelable);
1222         action.acceptObject(this, "date", mDate);
1223         action.acceptObject(this, "pattern", mPattern);
1224         action.acceptObject(this, "linkAddresses2", mLinkAddresses2);
1225         action.acceptObject(this, "linkAddresses", mLinkAddresses);
1226         action.acceptObject(this, "linkAddresses4", mLinkAddresses4);
1227         action.acceptObject(this, "stateName", mStateName);
1228         action.acceptObject(this, "flags", mFlags);
1229         action.acceptObject(this, "state", mState);
1230         action.acceptObject(this, "charSeq", charSeq);
1231         action.acceptObject(this, "linkAddresses5", mLinkAddresses5);
1232         action.acceptObject(this, "stringRes", mStringRes);
1233         action.acceptObject(this, "dayOfWeek", mDayOfWeek);
1234         action.acceptObject(this, "coords", mCoords);
1235     }
1236 
1237     @DataClass.Generated.Member
1238     static Parcelling<Date> sParcellingForDate =
1239             Parcelling.Cache.get(
1240                     MyDateParcelling.class);
1241     static {
1242         if (sParcellingForDate == null) {
1243             sParcellingForDate = Parcelling.Cache.put(
1244                     new MyDateParcelling());
1245         }
1246     }
1247 
1248     @DataClass.Generated.Member
1249     static Parcelling<Pattern> sParcellingForPattern =
1250             Parcelling.Cache.get(
1251                     Parcelling.BuiltIn.ForPattern.class);
1252     static {
1253         if (sParcellingForPattern == null) {
1254             sParcellingForPattern = Parcelling.Cache.put(
1255                     new Parcelling.BuiltIn.ForPattern());
1256         }
1257     }
1258 
1259     @Override
1260     @DataClass.Generated.Member
1261     public void writeToParcel(@NonNull Parcel dest, int flags) {
1262         // You can override field parcelling by defining methods like:
1263         // void parcelFieldName(Parcel dest, int flags) { ... }
1264 
1265         long flg = 0;
1266         if (mName != null) flg |= 0x8;
1267         if (mOtherParcelable != null) flg |= 0x40;
1268         if (mLinkAddresses4 != null) flg |= 0x800;
1269         if (mLinkAddresses5 != null) flg |= 0x10000;
1270         dest.writeLong(flg);
1271         dest.writeInt(mNum);
1272         dest.writeInt(mNum2);
1273         dest.writeInt(mNum4);
1274         if (mName != null) dest.writeString(mName);
1275         dest.writeString(mName2);
1276         dest.writeString(mName4);
1277         if (mOtherParcelable != null) dest.writeTypedObject(mOtherParcelable, flags);
1278         sParcellingForDate.parcel(mDate, dest, flags);
1279         sParcellingForPattern.parcel(mPattern, dest, flags);
1280         dest.writeParcelableList(mLinkAddresses2, flags);
1281         dest.writeParcelableList(mLinkAddresses, flags);
1282         if (mLinkAddresses4 != null) dest.writeTypedArray(mLinkAddresses4, flags);
1283         dest.writeString(mStateName);
1284         dest.writeInt(mFlags);
1285         dest.writeInt(mState);
1286         dest.writeCharSequence(charSeq);
1287         if (mLinkAddresses5 != null) dest.writeTypedArray(mLinkAddresses5, flags);
1288         dest.writeInt(mStringRes);
1289         dest.writeInt(mDayOfWeek);
1290         dest.writeFloatArray(mCoords);
1291     }
1292 
1293     @Override
1294     @DataClass.Generated.Member
1295     public int describeContents() { return 0; }
1296 
1297     /** @hide */
1298     @SuppressWarnings({"unchecked", "RedundantCast"})
1299     @DataClass.Generated.Member
1300     /* package-private */ SampleDataClass(@NonNull Parcel in) {
1301         // You can override field unparcelling by defining methods like:
1302         // static FieldType unparcelFieldName(Parcel in) { ... }
1303 
1304         long flg = in.readLong();
1305         int num = in.readInt();
1306         int num2 = in.readInt();
1307         int num4 = in.readInt();
1308         String name = (flg & 0x8) == 0 ? null : in.readString();
1309         String name2 = in.readString();
1310         String name4 = in.readString();
1311         AccessibilityNodeInfo otherParcelable = (flg & 0x40) == 0 ? null : (AccessibilityNodeInfo) in.readTypedObject(AccessibilityNodeInfo.CREATOR);
1312         Date date = sParcellingForDate.unparcel(in);
1313         Pattern pattern = sParcellingForPattern.unparcel(in);
1314         List<LinkAddress> linkAddresses2 = new ArrayList<>();
1315         in.readParcelableList(linkAddresses2, LinkAddress.class.getClassLoader());
1316         ArrayList<LinkAddress> linkAddresses = new ArrayList<>();
1317         in.readParcelableList(linkAddresses, LinkAddress.class.getClassLoader());
1318         LinkAddress[] linkAddresses4 = (flg & 0x800) == 0 ? null : (LinkAddress[]) in.createTypedArray(LinkAddress.CREATOR);
1319         String stateName = in.readString();
1320         int flags = in.readInt();
1321         int state = in.readInt();
1322         CharSequence _charSeq = (CharSequence) in.readCharSequence();
1323         LinkAddress[] linkAddresses5 = (flg & 0x10000) == 0 ? null : (LinkAddress[]) in.createTypedArray(LinkAddress.CREATOR);
1324         int stringRes = in.readInt();
1325         int dayOfWeek = in.readInt();
1326         float[] coords = in.createFloatArray();
1327 
1328         this.mNum = num;
1329         this.mNum2 = num2;
1330         this.mNum4 = num4;
1331         this.mName = name;
1332         this.mName2 = name2;
1333         AnnotationValidations.validate(
1334                 NonNull.class, null, mName2);
1335         this.mName4 = name4;
1336         AnnotationValidations.validate(
1337                 NonNull.class, null, mName4);
1338         this.mOtherParcelable = otherParcelable;
1339         this.mDate = date;
1340         AnnotationValidations.validate(
1341                 NonNull.class, null, mDate);
1342         this.mPattern = pattern;
1343         AnnotationValidations.validate(
1344                 NonNull.class, null, mPattern);
1345         this.mLinkAddresses2 = linkAddresses2;
1346         AnnotationValidations.validate(
1347                 NonNull.class, null, mLinkAddresses2);
1348         this.mLinkAddresses = linkAddresses;
1349         AnnotationValidations.validate(
1350                 NonNull.class, null, mLinkAddresses);
1351         this.mLinkAddresses4 = linkAddresses4;
1352         this.mStateName = stateName;
1353 
1354         if (!(Objects.equals(mStateName, STATE_NAME_UNDEFINED))
1355                 && !(Objects.equals(mStateName, STATE_NAME_ON))
1356                 && !(Objects.equals(mStateName, STATE_NAME_OFF))) {
1357             throw new java.lang.IllegalArgumentException(
1358                     "stateName was " + mStateName + " but must be one of: "
1359                             + "STATE_NAME_UNDEFINED(" + STATE_NAME_UNDEFINED + "), "
1360                             + "STATE_NAME_ON(" + STATE_NAME_ON + "), "
1361                             + "STATE_NAME_OFF(" + STATE_NAME_OFF + ")");
1362         }
1363 
1364         AnnotationValidations.validate(
1365                 NonNull.class, null, mStateName);
1366         this.mFlags = flags;
1367 
1368         Preconditions.checkFlagsArgument(
1369                 mFlags,
1370                 FLAG_MANUAL_REQUEST
1371                         | FLAG_COMPATIBILITY_MODE_REQUEST
1372                         | FLAG_AUGMENTED_REQUEST);
1373         this.mState = state;
1374 
1375         if (!(mState == STATE_UNDEFINED)
1376                 && !(mState == STATE_ON)
1377                 && !(mState == STATE_OFF)) {
1378             throw new java.lang.IllegalArgumentException(
1379                     "state was " + mState + " but must be one of: "
1380                             + "STATE_UNDEFINED(" + STATE_UNDEFINED + "), "
1381                             + "STATE_ON(" + STATE_ON + "), "
1382                             + "STATE_OFF(" + STATE_OFF + ")");
1383         }
1384 
1385         this.charSeq = _charSeq;
1386         AnnotationValidations.validate(
1387                 NonNull.class, null, charSeq);
1388         this.mLinkAddresses5 = linkAddresses5;
1389         this.mStringRes = stringRes;
1390         AnnotationValidations.validate(
1391                 StringRes.class, null, mStringRes);
1392         this.mDayOfWeek = dayOfWeek;
1393         AnnotationValidations.validate(
1394                 android.annotation.IntRange.class, null, mDayOfWeek,
1395                 "from", 0,
1396                 "to", 6);
1397         this.mCoords = coords;
1398         AnnotationValidations.validate(
1399                 Size.class, null, mCoords.length,
1400                 "value", 2);
1401         AnnotationValidations.validate(
1402                 NonNull.class, null, mCoords);
1403         int coordsSize = mCoords.length;
1404         for (int i = 0; i < coordsSize; i++) {
1405             AnnotationValidations.validate(
1406                     FloatRange.class, null, mCoords[i],
1407                     "from", 0f);
1408         }
1409 
1410 
1411         onConstructed();
1412     }
1413 
1414     @DataClass.Generated.Member
1415     public static final @NonNull Parcelable.Creator<SampleDataClass> CREATOR
1416             = new Parcelable.Creator<SampleDataClass>() {
1417         @Override
1418         public SampleDataClass[] newArray(int size) {
1419             return new SampleDataClass[size];
1420         }
1421 
1422         @Override
1423         public SampleDataClass createFromParcel(@NonNull Parcel in) {
1424             return new SampleDataClass(in);
1425         }
1426     };
1427 
1428     /**
1429      * A builder for {@link SampleDataClass}
1430      */
1431     @SuppressWarnings("WeakerAccess")
1432     @DataClass.Generated.Member
1433     public static final class Builder {
1434 
1435         private int mNum;
1436         private int mNum2;
1437         private int mNum4;
1438         private @Nullable String mName;
1439         private @NonNull String mName2;
1440         private @NonNull String mName4;
1441         private @Nullable AccessibilityNodeInfo mOtherParcelable;
1442         private @NonNull Date mDate;
1443         private @NonNull Pattern mPattern;
1444         private @NonNull List<LinkAddress> mLinkAddresses2;
1445         private @NonNull ArrayList<LinkAddress> mLinkAddresses;
1446         private @Nullable LinkAddress[] mLinkAddresses4;
1447         private @StateName @NonNull String mStateName;
1448         private @RequestFlags int mFlags;
1449         private @State int mState;
1450         private @NonNull CharSequence charSeq;
1451         private @Nullable LinkAddress[] mLinkAddresses5;
1452         private @StringRes int mStringRes;
1453         private @android.annotation.IntRange(from = 0, to = 6) int mDayOfWeek;
1454         private @Size(2) @NonNull @FloatRange(from = 0f) float[] mCoords;
1455 
1456         private long mBuilderFieldsSet = 0L;
1457 
1458         /**
1459          * Creates a new Builder.
1460          *
1461          * @param num
1462          *   Any property javadoc should go onto the field, and will be copied where appropriate,
1463          *   including getters, constructor parameters, builder setters, etc.
1464          *
1465          *   <p>
1466          *   This allows to avoid the burden of maintaining copies of the same documentation
1467          *   pieces in multiple places for each field.
1468          * @param num2
1469          *   Various javadoc features should work as expected when copied, e.g {@code code},
1470          *   {@link #mName links}, <a href="https://google.com">html links</a>, etc.
1471          * @param num4
1472          *   {@code @hide} javadoc annotation is also propagated, which can be used to adjust the
1473          *   desired public API surface.
1474          * @param name
1475          *   {@link Nullable} or {@link NonNull} annotation is required on all non-primitive fields.
1476          * @param flags
1477          *   Fields annotated with {@link IntDef} annotations also get a proper {@link #toString()} value.
1478          * @param linkAddresses5
1479          *   Final fields suppress generating a setter (when setters are requested).
1480          */
1481         public Builder(
1482                 int num,
1483                 int num2,
1484                 int num4,
1485                 @Nullable String name,
1486                 @RequestFlags int flags,
1487                 @Nullable LinkAddress[] linkAddresses5) {
1488             mNum = num;
1489             mNum2 = num2;
1490             mNum4 = num4;
1491             mName = name;
1492             mFlags = flags;
1493 
1494             Preconditions.checkFlagsArgument(
1495                     mFlags,
1496                     FLAG_MANUAL_REQUEST
1497                             | FLAG_COMPATIBILITY_MODE_REQUEST
1498                             | FLAG_AUGMENTED_REQUEST);
1499             mLinkAddresses5 = linkAddresses5;
1500         }
1501 
1502         /**
1503          * Any property javadoc should go onto the field, and will be copied where appropriate,
1504          * including getters, constructor parameters, builder setters, etc.
1505          *
1506          * <p>
1507          * This allows to avoid the burden of maintaining copies of the same documentation
1508          * pieces in multiple places for each field.
1509          */
1510         @DataClass.Generated.Member
1511         public @NonNull Builder setNum(int value) {
1512             checkNotUsed();
1513             mBuilderFieldsSet |= 0x1;
1514             mNum = value;
1515             return this;
1516         }
1517 
1518         /**
1519          * Various javadoc features should work as expected when copied, e.g {@code code},
1520          * {@link #mName links}, <a href="https://google.com">html links</a>, etc.
1521          *
1522          * @see #mNum2 ..and so should blocks at the bottom, e.g. {@code @see} blocks.
1523          */
1524         @DataClass.Generated.Member
1525         public @NonNull Builder setNum2(int value) {
1526             checkNotUsed();
1527             mBuilderFieldsSet |= 0x2;
1528             mNum2 = value;
1529             return this;
1530         }
1531 
1532         /**
1533          * {@code @hide} javadoc annotation is also propagated, which can be used to adjust the
1534          * desired public API surface.
1535          *
1536          * @see #getNum4() is hidden
1537          * @see Builder#setNum4(int) also hidden
1538          * @hide
1539          */
1540         @DataClass.Generated.Member
1541         public @NonNull Builder setNum4(int value) {
1542             checkNotUsed();
1543             mBuilderFieldsSet |= 0x4;
1544             mNum4 = value;
1545             return this;
1546         }
1547 
1548         /**
1549          * {@link Nullable} or {@link NonNull} annotation is required on all non-primitive fields.
1550          */
1551         @DataClass.Generated.Member
1552         public @NonNull Builder setName(@NonNull String value) {
1553             checkNotUsed();
1554             mBuilderFieldsSet |= 0x8;
1555             mName = value;
1556             return this;
1557         }
1558 
1559         /**
1560          * Fields with default value expressions ("mFoo = ...") are optional, and are automatically
1561          * initialized to the provided default expression, unless explicitly set.
1562          *
1563          * When using a {@link Builder} optional fields are passed via a {@link Builder#setName2 setter}
1564          * while mandatory fields are passed via {@link Builder#Builder constructor}.
1565          */
1566         @DataClass.Generated.Member
1567         public @NonNull Builder setName2(@NonNull String value) {
1568             checkNotUsed();
1569             mBuilderFieldsSet |= 0x10;
1570             mName2 = value;
1571             return this;
1572         }
1573 
1574         /**
1575          * Alternatively, when default value computation is expensive,
1576          * {@link #defaultName4 defaultFieldName()} can be defined to compute the default value.
1577          */
1578         @DataClass.Generated.Member
1579         public @NonNull Builder setName4(@NonNull String value) {
1580             checkNotUsed();
1581             mBuilderFieldsSet |= 0x20;
1582             mName4 = value;
1583             return this;
1584         }
1585 
1586         /**
1587          * For parcelling, any field type supported by {@link Parcel} is supported out of the box.
1588          * E.g. {@link Parcelable} subclasses, {@link String}, {@link int}, {@link boolean}, etc.
1589          */
1590         @DataClass.Generated.Member
1591         public @NonNull Builder setOtherParcelable(@NonNull AccessibilityNodeInfo value) {
1592             checkNotUsed();
1593             mBuilderFieldsSet |= 0x40;
1594             mOtherParcelable = value;
1595             return this;
1596         }
1597 
1598         /**
1599          * Additionally, support for parcelling other types can be added by implementing a
1600          * {@link Parcelling}, and referencing it in the {@link DataClass.ParcelWith} field annotation.
1601          *
1602          * @see MyDateParcelling an example {@link Parcelling} implementation
1603          */
1604         @DataClass.Generated.Member
1605         public @NonNull Builder setDate(@NonNull Date value) {
1606             checkNotUsed();
1607             mBuilderFieldsSet |= 0x80;
1608             mDate = value;
1609             return this;
1610         }
1611 
1612         /**
1613          * If a {@link Parcelling} is fairly common, consider putting it in {@link Parcelling.BuiltIn}
1614          * to encourage its reuse.
1615          */
1616         @DataClass.Generated.Member
1617         public @NonNull Builder setPattern(@NonNull Pattern value) {
1618             checkNotUsed();
1619             mBuilderFieldsSet |= 0x100;
1620             mPattern = value;
1621             return this;
1622         }
1623 
1624         /**
1625          * For lists, when using a {@link Builder}, other than a regular
1626          * {@link Builder#setLinkAddresses2(List) setter}, and additional
1627          * {@link Builder#addLinkAddresses2(LinkAddress) add} method is generated for convenience.
1628          */
1629         @DataClass.Generated.Member
1630         public @NonNull Builder setLinkAddresses2(@NonNull List<LinkAddress> value) {
1631             checkNotUsed();
1632             mBuilderFieldsSet |= 0x200;
1633             mLinkAddresses2 = value;
1634             return this;
1635         }
1636 
1637         /** @see #setLinkAddresses2 */
1638         @DataClass.Generated.Member
1639         public @NonNull Builder addLinkAddresses2(@NonNull LinkAddress value) {
1640             // You can refine this method's name by providing item's singular name, e.g.:
1641             // @DataClass.PluralOf("item")) mItems = ...
1642 
1643             if (mLinkAddresses2 == null) setLinkAddresses2(new ArrayList<>());
1644             mLinkAddresses2.add(value);
1645             return this;
1646         }
1647 
1648         /**
1649          * For aesthetics, you may want to consider providing a singular version of the plural field
1650          * name, which would be used for the {@link #mLinkAddresses2 above mentioned} "add" method.
1651          *
1652          * @see Builder#addLinkAddress(LinkAddress)
1653          */
1654         @DataClass.Generated.Member
1655         public @NonNull Builder setLinkAddresses(@NonNull ArrayList<LinkAddress> value) {
1656             checkNotUsed();
1657             mBuilderFieldsSet |= 0x400;
1658             mLinkAddresses = value;
1659             return this;
1660         }
1661 
1662         /** @see #setLinkAddresses */
1663         @DataClass.Generated.Member
1664         public @NonNull Builder addLinkAddress(@NonNull LinkAddress value) {
1665             if (mLinkAddresses == null) setLinkAddresses(new ArrayList<>());
1666             mLinkAddresses.add(value);
1667             return this;
1668         }
1669 
1670         /**
1671          * For array fields, when using a {@link Builder}, vararg argument format is used for
1672          * convenience.
1673          *
1674          * @see Builder#setLinkAddresses4(LinkAddress...)
1675          */
1676         @DataClass.Generated.Member
1677         public @NonNull Builder setLinkAddresses4(@NonNull LinkAddress... value) {
1678             checkNotUsed();
1679             mBuilderFieldsSet |= 0x800;
1680             mLinkAddresses4 = value;
1681             return this;
1682         }
1683 
1684         /**
1685          * {@link IntDef}/{@link StringDef}-annotated fields propagate the annotation to
1686          * getter/constructor/setter/builder parameters, making for a nicer api.
1687          *
1688          * @see #getStateName
1689          * @see Builder#setStateName
1690          */
1691         @DataClass.Generated.Member
1692         public @NonNull Builder setStateName(@StateName @NonNull String value) {
1693             checkNotUsed();
1694             mBuilderFieldsSet |= 0x1000;
1695             mStateName = value;
1696             return this;
1697         }
1698 
1699         /**
1700          * Fields annotated with {@link IntDef} annotations also get a proper {@link #toString()} value.
1701          */
1702         @DataClass.Generated.Member
1703         public @NonNull Builder setFlags(@RequestFlags int value) {
1704             checkNotUsed();
1705             mBuilderFieldsSet |= 0x2000;
1706             mFlags = value;
1707             return this;
1708         }
1709 
1710         /**
1711          * Above is true for both {@link IntDef#flag flags} and enum-like {@link IntDef}s
1712          */
1713         @DataClass.Generated.Member
1714         public @NonNull Builder setState(@State int value) {
1715             checkNotUsed();
1716             mBuilderFieldsSet |= 0x4000;
1717             mState = value;
1718             return this;
1719         }
1720 
1721         /**
1722          * Making a field public will suppress getter generation in favor of accessing it directly.
1723          */
1724         @DataClass.Generated.Member
1725         public @NonNull Builder setCharSeq(@NonNull CharSequence value) {
1726             checkNotUsed();
1727             mBuilderFieldsSet |= 0x8000;
1728             charSeq = value;
1729             return this;
1730         }
1731 
1732         /**
1733          * Final fields suppress generating a setter (when setters are requested).
1734          */
1735         @DataClass.Generated.Member
1736         public @NonNull Builder setLinkAddresses5(@NonNull LinkAddress... value) {
1737             checkNotUsed();
1738             mBuilderFieldsSet |= 0x10000;
1739             mLinkAddresses5 = value;
1740             return this;
1741         }
1742 
1743         /**
1744          * Fields with certain annotations are automatically validated in constructor
1745          *
1746          * You can see overloads in {@link AnnotationValidations} for a list of currently
1747          * supported ones.
1748          *
1749          * You can also extend support to your custom annotations by creating another corresponding
1750          * overloads like
1751          * {@link AnnotationValidations#validate(Class, UserIdInt, int)}.
1752          *
1753          * @see #SampleDataClass
1754          */
1755         @DataClass.Generated.Member
1756         public @NonNull Builder setStringRes(@StringRes int value) {
1757             checkNotUsed();
1758             mBuilderFieldsSet |= 0x20000;
1759             mStringRes = value;
1760             return this;
1761         }
1762 
1763         /**
1764          * Validation annotations may also have parameters.
1765          *
1766          * Parameter values will be supplied to validation method as name-value pairs.
1767          *
1768          * @see AnnotationValidations#validate(Class, Size, int, String, int, String, int)
1769          */
1770         @DataClass.Generated.Member
1771         public @NonNull Builder setDayOfWeek(@android.annotation.IntRange(from = 0, to = 6) int value) {
1772             checkNotUsed();
1773             mBuilderFieldsSet |= 0x40000;
1774             mDayOfWeek = value;
1775             return this;
1776         }
1777 
1778         /**
1779          * Unnamed validation annotation parameter gets supplied to the validating method named as
1780          * "value".
1781          *
1782          * Validation annotations following {@link Each} annotation, will be applied for each
1783          * array/collection element instead.
1784          *
1785          * @see AnnotationValidations#validate(Class, Size, int, String, int)
1786          */
1787         @DataClass.Generated.Member
1788         public @NonNull Builder setCoords(@Size(2) @NonNull @FloatRange(from = 0f) float... value) {
1789             checkNotUsed();
1790             mBuilderFieldsSet |= 0x80000;
1791             mCoords = value;
1792             return this;
1793         }
1794 
1795         /** Builds the instance. This builder should not be touched after calling this! */
1796         public @NonNull SampleDataClass build() {
1797             checkNotUsed();
1798             mBuilderFieldsSet |= 0x100000; // Mark builder used
1799 
1800             if ((mBuilderFieldsSet & 0x10) == 0) {
1801                 mName2 = "Bob";
1802             }
1803             if ((mBuilderFieldsSet & 0x20) == 0) {
1804                 mName4 = defaultName4();
1805             }
1806             if ((mBuilderFieldsSet & 0x40) == 0) {
1807                 mOtherParcelable = null;
1808             }
1809             if ((mBuilderFieldsSet & 0x80) == 0) {
1810                 mDate = new Date(42 * 42);
1811             }
1812             if ((mBuilderFieldsSet & 0x100) == 0) {
1813                 mPattern = Pattern.compile("");
1814             }
1815             if ((mBuilderFieldsSet & 0x200) == 0) {
1816                 mLinkAddresses2 = new ArrayList<>();
1817             }
1818             if ((mBuilderFieldsSet & 0x400) == 0) {
1819                 mLinkAddresses = new ArrayList<>();
1820             }
1821             if ((mBuilderFieldsSet & 0x800) == 0) {
1822                 mLinkAddresses4 = null;
1823             }
1824             if ((mBuilderFieldsSet & 0x1000) == 0) {
1825                 mStateName = STATE_NAME_UNDEFINED;
1826             }
1827             if ((mBuilderFieldsSet & 0x4000) == 0) {
1828                 mState = STATE_UNDEFINED;
1829             }
1830             if ((mBuilderFieldsSet & 0x8000) == 0) {
1831                 charSeq = "";
1832             }
1833             if ((mBuilderFieldsSet & 0x20000) == 0) {
1834                 mStringRes = 0;
1835             }
1836             if ((mBuilderFieldsSet & 0x40000) == 0) {
1837                 mDayOfWeek = 3;
1838             }
1839             if ((mBuilderFieldsSet & 0x80000) == 0) {
1840                 mCoords = new float[] { 0f, 0f };
1841             }
1842             SampleDataClass o = new SampleDataClass(
1843                     mNum,
1844                     mNum2,
1845                     mNum4,
1846                     mName,
1847                     mName2,
1848                     mName4,
1849                     mOtherParcelable,
1850                     mDate,
1851                     mPattern,
1852                     mLinkAddresses2,
1853                     mLinkAddresses,
1854                     mLinkAddresses4,
1855                     mStateName,
1856                     mFlags,
1857                     mState,
1858                     charSeq,
1859                     mLinkAddresses5,
1860                     mStringRes,
1861                     mDayOfWeek,
1862                     mCoords);
1863             return o;
1864         }
1865 
1866         private void checkNotUsed() {
1867             if ((mBuilderFieldsSet & 0x100000) != 0) {
1868                 throw new IllegalStateException(
1869                         "This Builder should not be reused. Use a new Builder instance instead");
1870             }
1871         }
1872     }
1873 
1874     @DataClass.Generated(
1875             time = 1582685647656L,
1876             codegenVersion = "1.0.15",
1877             sourceFile = "frameworks/base/tests/Codegen/src/com/android/codegentest/SampleDataClass.java",
1878             inputSignatures = "public static final  java.lang.String STATE_NAME_UNDEFINED\npublic static final  java.lang.String STATE_NAME_ON\npublic static final  java.lang.String STATE_NAME_OFF\npublic static final  int STATE_UNDEFINED\npublic static final  int STATE_ON\npublic static final  int STATE_OFF\npublic static final @com.android.codegentest.SampleDataClass.RequestFlags int FLAG_MANUAL_REQUEST\npublic static final @com.android.codegentest.SampleDataClass.RequestFlags int FLAG_COMPATIBILITY_MODE_REQUEST\npublic static final @com.android.codegentest.SampleDataClass.RequestFlags int FLAG_AUGMENTED_REQUEST\nprivate  int mNum\nprivate  int mNum2\nprivate  int mNum4\nprivate @android.annotation.Nullable java.lang.String mName\nprivate @android.annotation.NonNull java.lang.String mName2\nprivate @android.annotation.NonNull java.lang.String mName4\nprivate @android.annotation.Nullable android.view.accessibility.AccessibilityNodeInfo mOtherParcelable\nprivate @com.android.internal.util.DataClass.ParcelWith(com.android.codegentest.MyDateParcelling.class) @android.annotation.NonNull java.util.Date mDate\nprivate @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForPattern.class) @android.annotation.NonNull java.util.regex.Pattern mPattern\nprivate @android.annotation.NonNull java.util.List<android.net.LinkAddress> mLinkAddresses2\nprivate @com.android.internal.util.DataClass.PluralOf(\"linkAddress\") @android.annotation.NonNull java.util.ArrayList<android.net.LinkAddress> mLinkAddresses\nprivate @android.annotation.Nullable android.net.LinkAddress[] mLinkAddresses4\nprivate @com.android.codegentest.SampleDataClass.StateName @android.annotation.NonNull java.lang.String mStateName\nprivate @com.android.codegentest.SampleDataClass.RequestFlags int mFlags\nprivate @com.android.codegentest.SampleDataClass.State int mState\npublic @android.annotation.NonNull java.lang.CharSequence charSeq\nprivate final @android.annotation.Nullable android.net.LinkAddress[] mLinkAddresses5\nprivate transient  android.net.LinkAddress[] mLinkAddresses6\ntransient  int[] mTmpStorage\nprivate @android.annotation.StringRes int mStringRes\nprivate @android.annotation.IntRange(from=0L, to=6L) int mDayOfWeek\nprivate @android.annotation.Size(2L) @android.annotation.NonNull @com.android.internal.util.DataClass.Each @android.annotation.FloatRange(from=0.0) float[] mCoords\nprivate static  java.lang.String defaultName4()\nprivate  int[] lazyInitTmpStorage()\npublic  android.net.LinkAddress[] getLinkAddresses4()\nprivate  boolean patternEquals(java.util.regex.Pattern)\nprivate  int patternHashCode()\nprivate  void onConstructed()\npublic  void dump(java.io.PrintWriter)\nclass SampleDataClass extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genBuilder=true, genConstructor=true, genEqualsHashCode=true, genToString=true, genForEachField=true, genSetters=true)")
1879     @Deprecated
1880     private void __metadata() {}
1881 
1882 
1883     //@formatter:on
1884     // End of generated code
1885 
1886 }
1887