Builder
class Builder
kotlin.Any | |
↳ | android.service.autofill.UserData.Builder |
A builder for UserData
objects.
Summary
Public constructors | |
---|---|
Creates a new builder for the user data used for field classification. |
Public methods | |
---|---|
UserData.Builder |
Adds a new value for user data. |
UserData |
build() Creates a new |
UserData.Builder |
setFieldClassificationAlgorithm(name: String?, args: Bundle?) Sets the default algorithm used for field classification. |
UserData.Builder |
setFieldClassificationAlgorithmForCategory(categoryId: String, name: String?, args: Bundle?) Sets the algorithm used for field classification for the specified category. |
Public constructors
Builder
Builder(
id: String,
value: String,
categoryId: String)
Creates a new builder for the user data used for field classification.
The user data must contain at least one pair of value
-> categoryId
, and more pairs can be added through the add(java.lang.String,java.lang.String)
method. For example:
new UserData.Builder("v1", "Bart Simpson", "name") .add("[email protected]", "email") .add("[email protected]", "email") .build();
Parameters | |
---|---|
id |
String: id used to identify the whole UserData object. This id is also returned by AutofillManager.getUserDataId() , which can be used to check if the UserData is up-to-date without fetching the whole object (through AutofillManager.getUserData() ). This value cannot be null . |
value |
String: value of the user data. This value cannot be null . |
categoryId |
String: autofill field category. This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if any of the following occurs:
|
Public methods
add
fun add(
value: String,
categoryId: String
): UserData.Builder
Adds a new value for user data.
Parameters | |
---|---|
value |
String: value of the user data. This value cannot be null . |
categoryId |
String: string used to identify the category the value is associated with. This value cannot be null . |
Return | |
---|---|
UserData.Builder |
This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalStateException |
if:
|
java.lang.IllegalArgumentException |
if any of the following occurs:
|
build
fun build(): UserData
Creates a new UserData
instance.
You should not interact with this builder once this method is called.
Return | |
---|---|
UserData |
The built dataset. This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalStateException |
if build() was already called. |
setFieldClassificationAlgorithm
fun setFieldClassificationAlgorithm(
name: String?,
args: Bundle?
): UserData.Builder
Sets the default algorithm used for field classification.
The currently available algorithms can be retrieve through AutofillManager.getAvailableFieldClassificationAlgorithms()
.
If not set, the default algorithm
is used instead.
Parameters | |
---|---|
name |
String?: name of the algorithm or null to used default. |
args |
Bundle?: optional arguments to the algorithm. This value may be null . |
Return | |
---|---|
UserData.Builder |
this builder This value cannot be null . |
setFieldClassificationAlgorithmForCategory
fun setFieldClassificationAlgorithmForCategory(
categoryId: String,
name: String?,
args: Bundle?
): UserData.Builder
Sets the algorithm used for field classification for the specified category.
The currently available algorithms can be retrieved through AutofillManager.getAvailableFieldClassificationAlgorithms()
.
If not set, the default algorithm
is used instead.
Parameters | |
---|---|
categoryId |
String: autofill field category. This value cannot be null . |
name |
String?: name of the algorithm or null to used default. |
args |
Bundle?: optional arguments to the algorithm. This value may be null . |
Return | |
---|---|
UserData.Builder |
this builder This value cannot be null . |