code: public boolean isTextValid(String text) {
          // If the text is null, return false.
          if (text == null) {
              return false;
          }
          // If the text is empty, return the value of allowEmptyTimes.
          text = text.trim();
          if (text.isEmpty()) {
              return settings.getAllowEmptyTimes();
          }
          // Try to get a parsed time.
          LocalTime parsedTime = InternalUtilities.getParsedTimeOrNull(text, settings.getFormatForDisplayTime(), settings.getFormatForMenuTimes(),
                  settings.formatsForParsing, settings.getLocale());
  
          // If the time could not be parsed, return false.
          if (parsedTime == null) {
              return false;
          }
          // If the time is vetoed, return false.
          TimeVetoPolicy vetoPolicy = settings.getVetoPolicy();
          if (InternalUtilities.isTimeVetoed(vetoPolicy, parsedTime)) {
              return false;
          }
          // The time is valid, so return true.
          return true;
      }
docs: isTextValid, This function can be used to see if the supplied text represents a "valid time"
  according to the settings of this time picker.
  
  More specifically, this returns true if: 1) the text contains a parsable time that exists,
  and that has not been vetoed by a current veto policy, OR 2) (allowEmptyTimes == true) and
  text.trim() contains an empty string. Otherwise returns false.