code: public static boolean isValid(@Nullable final String weeklyOpeningHours) {
          if (weeklyOpeningHours == null) {
              return true;
          }
  
          final List<DayOpeningHours> all = new ArrayList<>();
  
          final StringTokenizer tok = new StringTokenizer(weeklyOpeningHours, ",");
          if (tok.countTokens() == 0) {
              return false;
          }
          while (tok.hasMoreTokens()) {
              final String part = tok.nextToken();
  
              // Find divider between day(s) and hours
              final int p = part.indexOf(' ');
              if (p < 0) {
                  return false;
              }
  
              // Make sure first part is one or more days
              final String dayPartStr = part.substring(0, p);
              if (!MultiDayOfTheWeek.isValid(dayPartStr)) {
                  return false;
              }
              final MultiDayOfTheWeek dayPart = MultiDayOfTheWeek.valueOf(dayPartStr);
  
              // Next part should be one or more hours
              final String hourPartStr = part.substring(p + 1);
              if (!HourRanges.isValid(hourPartStr)) {
                  return false;
              }
              final HourRanges hourPart = new HourRanges(hourPartStr);
  
              // Avoid duplicate days
              for (DayOfTheWeek dow : dayPart) {
                  final DayOpeningHours doh = new DayOpeningHours(dow, hourPart);
                  if (all.contains(doh)) {
                      return false;
                  }
                  all.add(doh);
              }
  
              // Make sure the hours of the days do not overlap
              for (final DayOpeningHours doh : all) {
                  final List<DayOpeningHours> normalized = doh.normalize();
                  if (normalized.size() == 2) {
                      final DayOpeningHours secondDay = normalized.get(1);
                      final int idx = all.indexOf(secondDay);
                      if (idx > -1) {
                          final DayOpeningHours day = all.get(idx);
                          if (day.overlaps(secondDay)) {
                              return false;
                          }
                      }
                  }
              }
  
          }
          return true;
      }
docs: Verifies if the string is valid and could be converted into an object.
  
  @param weeklyOpeningHours
  Hour weeklyOpeningHours string to test.
  
  @return {@literal true} if the string is a valid string, else {@literal false}.