Stay organized with collections
Save and categorize content based on your preferences.
Validators
class Validators
Factory for Validator
operations.
See SaveInfo.Builder.setValidator(Validator)
for examples.
Summary
Public methods |
static Validator |
Creates a validator that is only valid if all validators are valid.
|
static Validator |
Creates a validator that is valid when validator is not, and vice versa.
|
static Validator |
Creates a validator that is valid if any of the validators is valid.
|
Public methods
and
static fun and(vararg validators: Validator!): Validator
Creates a validator that is only valid if all validators
are valid.
Used to represent an AND
boolean operation in a chain of validators.
Parameters |
validators |
Validator!: This value cannot be null . |
Exceptions |
java.lang.IllegalArgumentException |
if any element of validators is an instance of a class that is not provided by the Android System. |
not
static fun not(validator: Validator): Validator
Creates a validator that is valid when validator
is not, and vice versa.
Used to represent a NOT
boolean operation in a chain of validators.
Parameters |
validator |
Validator: This value cannot be null . |
Exceptions |
java.lang.IllegalArgumentException |
if validator is an instance of a class that is not provided by the Android System. |
or
static fun or(vararg validators: Validator!): Validator
Creates a validator that is valid if any of the validators
is valid.
Used to represent an OR
boolean operation in a chain of validators.
Parameters |
validators |
Validator!: This value cannot be null . |
Exceptions |
java.lang.IllegalArgumentException |
if any element of validators is an instance of a class that is not provided by the Android System. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# Validators\n\nAdded in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nValidators\n==========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/service/autofill/Validators \"View this page in Java\") \n\n```\nclass Validators\n```\n\n|---|------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.service.autofill.Validators](#) |\n\nFactory for [Validator](/reference/kotlin/android/service/autofill/Validator) operations.\n\nSee [SaveInfo.Builder.setValidator(Validator)](/reference/kotlin/android/service/autofill/SaveInfo.Builder#setValidator(android.service.autofill.Validator)) for examples.\n\nSummary\n-------\n\n| Public methods ||\n|--------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [Validator](/reference/kotlin/android/service/autofill/Validator) | [and](#and(android.service.autofill.Validator))`(`vararg` `validators:` `[Validator](/reference/kotlin/android/service/autofill/Validator)!`)` Creates a validator that is only valid if all `validators` are valid. |\n| static [Validator](/reference/kotlin/android/service/autofill/Validator) | [not](#not(android.service.autofill.Validator))`(`validator:` `[Validator](/reference/kotlin/android/service/autofill/Validator)`)` Creates a validator that is valid when `validator` is not, and vice versa. |\n| static [Validator](/reference/kotlin/android/service/autofill/Validator) | [or](#or(android.service.autofill.Validator))`(`vararg` `validators:` `[Validator](/reference/kotlin/android/service/autofill/Validator)!`)` Creates a validator that is valid if any of the `validators` is valid. |\n\nPublic methods\n--------------\n\n### and\n\nAdded in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic fun and(vararg validators: Validator!): Validator\n```\n\nCreates a validator that is only valid if all `validators` are valid.\n\nUsed to represent an `AND` boolean operation in a chain of validators.\n\n| Parameters ||\n|--------------|--------------------------------------------------------------------------------------------------|\n| `validators` | [Validator](/reference/kotlin/android/service/autofill/Validator)!: This value cannot be `null`. |\n\n| Return ||\n|-------------------------------------------------------------------|------------------------------|\n| [Validator](/reference/kotlin/android/service/autofill/Validator) | This value cannot be `null`. |\n\n| Exceptions ||\n|--------------------------------------|------------------------------------------------------------------------------------------------------|\n| `java.lang.IllegalArgumentException` | if any element of `validators` is an instance of a class that is not provided by the Android System. |\n\n### not\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic fun not(validator: Validator): Validator\n```\n\nCreates a validator that is valid when `validator` is not, and vice versa.\n\nUsed to represent a `NOT` boolean operation in a chain of validators.\n\n| Parameters ||\n|-------------|-------------------------------------------------------------------------------------------------|\n| `validator` | [Validator](/reference/kotlin/android/service/autofill/Validator): This value cannot be `null`. |\n\n| Return ||\n|-------------------------------------------------------------------|------------------------------|\n| [Validator](/reference/kotlin/android/service/autofill/Validator) | This value cannot be `null`. |\n\n| Exceptions ||\n|--------------------------------------|--------------------------------------------------------------------------------------|\n| `java.lang.IllegalArgumentException` | if `validator` is an instance of a class that is not provided by the Android System. |\n\n### or\n\nAdded in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic fun or(vararg validators: Validator!): Validator\n```\n\nCreates a validator that is valid if any of the `validators` is valid.\n\nUsed to represent an `OR` boolean operation in a chain of validators.\n\n| Parameters ||\n|--------------|--------------------------------------------------------------------------------------------------|\n| `validators` | [Validator](/reference/kotlin/android/service/autofill/Validator)!: This value cannot be `null`. |\n\n| Return ||\n|-------------------------------------------------------------------|------------------------------|\n| [Validator](/reference/kotlin/android/service/autofill/Validator) | This value cannot be `null`. |\n\n| Exceptions ||\n|--------------------------------------|------------------------------------------------------------------------------------------------------|\n| `java.lang.IllegalArgumentException` | if any element of `validators` is an instance of a class that is not provided by the Android System. |"]]