Java Code Examples for com.android.internal.util.Preconditions#checkArrayElementsNotNull()

The following examples show how to use com.android.internal.util.Preconditions#checkArrayElementsNotNull() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Validators.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private static InternalValidator[] getInternalValidators(Validator[] validators) {
    Preconditions.checkArrayElementsNotNull(validators, "validators");

    final InternalValidator[] internals = new InternalValidator[validators.length];

    for (int i = 0; i < validators.length; i++) {
        Preconditions.checkArgument((validators[i] instanceof InternalValidator),
                "element " + i + " not provided by Android System: " + validators[i]);
        internals[i] = (InternalValidator) validators[i];
    }
    return internals;
}
 
Example 2
Source File: OptionalValidators.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
OptionalValidators(@NonNull InternalValidator[] validators) {
    mValidators = Preconditions.checkArrayElementsNotNull(validators, "validators");
}
 
Example 3
Source File: RequiredValidators.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
RequiredValidators(@NonNull InternalValidator[] validators) {
    mValidators = Preconditions.checkArrayElementsNotNull(validators, "validators");
}
 
Example 4
Source File: FillResponse.java    From android_9.0.0_r45 with Apache License 2.0 3 votes vote down vote up
/**
 * Sets which fields are used for
 * <a href="AutofillService.html#FieldClassification">field classification</a>
 *
 * <p><b>Note:</b> This method automatically adds the
 * {@link FillResponse#FLAG_TRACK_CONTEXT_COMMITED} to the {@link #setFlags(int) flags}.

 * @throws IllegalArgumentException is length of {@code ids} args is more than
 * {@link UserData#getMaxFieldClassificationIdsSize()}.
 * @throws IllegalStateException if {@link #build()} or {@link #disableAutofill(long)} was
 * already called.
 * @throws NullPointerException if {@code ids} or any element on it is {@code null}.
 */
public Builder setFieldClassificationIds(@NonNull AutofillId... ids) {
    throwIfDestroyed();
    throwIfDisableAutofillCalled();
    Preconditions.checkArrayElementsNotNull(ids, "ids");
    Preconditions.checkArgumentInRange(ids.length, 1,
            UserData.getMaxFieldClassificationIdsSize(), "ids length");
    mFieldClassificationIds = ids;
    mFlags |= FLAG_TRACK_CONTEXT_COMMITED;
    return this;
}
 
Example 5
Source File: LuhnChecksumValidator.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
  * Default constructor.
  *
  * @param ids id of fields that comprises the number to be checked.
  */
public LuhnChecksumValidator(@NonNull AutofillId... ids) {
    mIds = Preconditions.checkArrayElementsNotNull(ids, "ids");
}
 
Example 6
Source File: UsbInterface.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Only used by UsbService implementation
 * @hide
 */
public void setEndpoints(Parcelable[] endpoints) {
    mEndpoints = Preconditions.checkArrayElementsNotNull(endpoints, "endpoints");
}
 
Example 7
Source File: UsbConfiguration.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Only used by UsbService implementation
 * @hide
 */
public void setInterfaces(@NonNull Parcelable[] interfaces) {
    mInterfaces = Preconditions.checkArrayElementsNotNull(interfaces, "interfaces");
}
 
Example 8
Source File: UsbDevice.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Only used by UsbService implementation
 * @hide
 */
public void setConfigurations(@NonNull Parcelable[] configuration) {
    mConfigurations = Preconditions.checkArrayElementsNotNull(configuration, "configuration");
}