code: protected static long validateDuration(@Nullable Duration value, String name) {
          if (value == null) {
              return -1;
          }
  
          checkArgument(!value.isNegative(), "%s: %s (expected: >= 0)", name, value);
          return value.getSeconds();
      }
docs: Makes sure the specified {@link Duration} is not negative.
  
  @param value the duration
  @param name the name of the parameter
  @return the duration converted into seconds