1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package android.view.autofill;
17 
18 
19 import android.annotation.Nullable;
20 import android.annotation.SuppressLint;
21 import android.view.View;
22 
23 import com.android.internal.util.DataClass;
24 
25 
26 /**
27  * Information for the virtual view to the autofill framework.
28  */
29 @DataClass(genBuilder = true)
30 public final class VirtualViewFillInfo {
31 
32     /**
33      * Autofill hints of the virtual view.
34      *
35      * @see View#setAutofillHints(String...)
36      */
37     @Nullable
38     @SuppressLint("NullableCollection")
39     private String[] mAutofillHints;
40 
defaultAutofillHints()41     private static String[] defaultAutofillHints() {
42         return null;
43     }
44 
45 
46 
47     // Code below generated by codegen v1.0.23.
48     //
49     // DO NOT MODIFY!
50     // CHECKSTYLE:OFF Generated code
51     //
52     // To regenerate run:
53     // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/view/autofill/VirtualViewFillInfo.java
54     //
55     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
56     //   Settings > Editor > Code Style > Formatter Control
57     //@formatter:off
58 
59 
60     @DataClass.Generated.Member
VirtualViewFillInfo( @ullable @uppressLintR) String[] autofillHints)61     /* package-private */ VirtualViewFillInfo(
62             @Nullable @SuppressLint("NullableCollection") String[] autofillHints) {
63         this.mAutofillHints = autofillHints;
64         com.android.internal.util.AnnotationValidations.validate(
65                 SuppressLint.class, null, mAutofillHints,
66                 "value", "NullableCollection");
67 
68         // onConstructed(); // You can define this method to get a callback
69     }
70 
71     /**
72      * Autofill hints of the virtual view.
73      *
74      * @see View#setAutofillHints(String...)
75      */
76     @DataClass.Generated.Member
getAutofillHints()77     public @Nullable @SuppressLint("NullableCollection") String[] getAutofillHints() {
78         return mAutofillHints;
79     }
80 
81     /**
82      * A builder for {@link VirtualViewFillInfo}
83      */
84     @SuppressWarnings("WeakerAccess")
85     @DataClass.Generated.Member
86     public static final class Builder {
87 
88         private @Nullable @SuppressLint("NullableCollection") String[] mAutofillHints;
89 
90         private long mBuilderFieldsSet = 0L;
91 
Builder()92         public Builder() {
93         }
94 
95         /**
96          * Autofill hints of the virtual view.
97          *
98          * @see View#setAutofillHints(String...)
99          */
100         @DataClass.Generated.Member
setAutofillHints(@uppressLintR) @ndroid.annotation.NonNull String... value)101         public @android.annotation.NonNull Builder setAutofillHints(@SuppressLint("NullableCollection") @android.annotation.NonNull String... value) {
102             checkNotUsed();
103             mBuilderFieldsSet |= 0x1;
104             mAutofillHints = value;
105             return this;
106         }
107 
108         /** Builds the instance. This builder should not be touched after calling this! */
build()109         public @android.annotation.NonNull VirtualViewFillInfo build() {
110             checkNotUsed();
111             mBuilderFieldsSet |= 0x2; // Mark builder used
112 
113             if ((mBuilderFieldsSet & 0x1) == 0) {
114                 mAutofillHints = defaultAutofillHints();
115             }
116             VirtualViewFillInfo o = new VirtualViewFillInfo(
117                     mAutofillHints);
118             return o;
119         }
120 
checkNotUsed()121         private void checkNotUsed() {
122             if ((mBuilderFieldsSet & 0x2) != 0) {
123                 throw new IllegalStateException(
124                         "This Builder should not be reused. Use a new Builder instance instead");
125             }
126         }
127     }
128 
129     @DataClass.Generated(
130             time = 1674023010954L,
131             codegenVersion = "1.0.23",
132             sourceFile = "frameworks/base/core/java/android/view/autofill/VirtualViewFillInfo.java",
133             inputSignatures = "private @android.annotation.Nullable @android.annotation.SuppressLint java.lang.String[] mAutofillHints\nprivate static  java.lang.String[] defaultAutofillHints()\nclass VirtualViewFillInfo extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genBuilder=true)")
134     @Deprecated
__metadata()135     private void __metadata() {}
136 
137 
138     //@formatter:on
139     // End of generated code
140 
141 }
142