Android 12 Developer Preview is here! Try it out, and give us your feedback!

CompositeDateValidator

public final class CompositeDateValidator
extends Object implements CalendarConstraints.DateValidator

java.lang.Object
   ↳ com.google.android.material.datepicker.CompositeDateValidator


A CalendarConstraints.DateValidator that accepts a list of Date Validators.

Summary

Inherited constants

Fields

public static final Creator<CompositeDateValidator> CREATOR

Part of Parcelable requirements.

Public methods

static CalendarConstraints.DateValidator allOf(List<CalendarConstraints.DateValidator> validators)

Returns a CalendarConstraints.DateValidator that can perform validation for every given validator.

static CalendarConstraints.DateValidator anyOf(List<CalendarConstraints.DateValidator> validators)

Returns a CalendarConstraints.DateValidator that can perform validation for any given validator.

int describeContents()
boolean equals(Object o)
int hashCode()
boolean isValid(long date)

Performs the CalendarConstraints.DateValidator.isValid(long) check as an AND of all validators.

void writeToParcel(Parcel dest, int flags)

Inherited methods

Fields

CREATOR

public static final Creator<CompositeDateValidator> CREATOR

Part of Parcelable requirements. Do not use.

Public methods

allOf

public static CalendarConstraints.DateValidator allOf (List<CalendarConstraints.DateValidator> validators)

Returns a CalendarConstraints.DateValidator that can perform validation for every given validator.

Parameters
validators List

Returns
CalendarConstraints.DateValidator

anyOf

public static CalendarConstraints.DateValidator anyOf (List<CalendarConstraints.DateValidator> validators)

Returns a CalendarConstraints.DateValidator that can perform validation for any given validator.

Parameters
validators List

Returns
CalendarConstraints.DateValidator

describeContents

public int describeContents ()

Returns
int

equals

public boolean equals (Object o)

Parameters
o Object

Returns
boolean

hashCode

public int hashCode ()

Returns
int

isValid

public boolean isValid (long date)

Performs the CalendarConstraints.DateValidator.isValid(long) check as an AND of all validators. e.g. If every validator in this class returns `true` for each CalendarConstraints.DateValidator.isValid(long), this this method will return true.

Parameters
date long: milliseconds date to validate against.

Returns
boolean True, if the given date is valid for every given validator in this class.

writeToParcel

public void writeToParcel (Parcel dest, 
                int flags)

Parameters
dest Parcel

flags int