| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.service.autofill; |
| 18 |
|
| 19 |
import static android.view.autofill.Helper.sDebug; |
| 20 |
|
| 21 |
import android.annotation.NonNull; |
| 22 |
import android.os.Parcel; |
| 23 |
import android.os.Parcelable; |
| 24 |
|
| 25 |
import java.util.Objects; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
final class NegationValidator extends InternalValidator { |
| 33 |
@NonNull private final InternalValidator mValidator; |
| 34 |
|
| 35 |
NegationValidator(@NonNull InternalValidator validator) { |
| 36 |
mValidator = Objects.requireNonNull(validator); |
| 37 |
} |
| 38 |
|
| 39 |
@Override |
| 40 |
public boolean isValid(@NonNull ValueFinder finder) { |
| 41 |
return !mValidator.isValid(finder); |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
@Override |
| 48 |
public String toString() { |
| 49 |
if (!sDebug) return super.toString(); |
| 50 |
|
| 51 |
return "NegationValidator: [validator=" + mValidator + "]"; |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
@Override |
| 58 |
public int describeContents() { |
| 59 |
return 0; |
| 60 |
} |
| 61 |
|
| 62 |
@Override |
| 63 |
public void writeToParcel(Parcel dest, int flags) { |
| 64 |
dest.writeParcelable(mValidator, flags); |
| 65 |
} |
| 66 |
|
| 67 |
public static final @android.annotation.NonNull Parcelable.Creator<NegationValidator> CREATOR = |
| 68 |
new Parcelable.Creator<NegationValidator>() { |
| 69 |
@Override |
| 70 |
public NegationValidator createFromParcel(Parcel parcel) { |
| 71 |
return new NegationValidator(parcel.readParcelable(null, android.service.autofill.InternalValidator.class)); |
| 72 |
} |
| 73 |
|
| 74 |
@Override |
| 75 |
public NegationValidator[] newArray(int size) { |
| 76 |
return new NegationValidator[size]; |
| 77 |
} |
| 78 |
}; |
| 79 |
} |