core/metrics-model/src/main/java/org/hawkular/metrics/model/Interval.java
public static Interval parse(String s) {
        if (s.isEmpty()) {
            return NONE;
        }

        Matcher matcher = INTERVAL_PATTERN.matcher(s);
        if (!(matcher.matches() && matcher.groupCount() == 2)) {
            throw new IllegalArgumentException(s + " is not a valid interval. It must follow the pattern " +
                INTERVAL_PATTERN.pattern());
        }
        return new Interval(Integer.parseInt(matcher.group(1)), Units.fromCode(matcher.group(2)));
    }
public static Interval parse(String s) {
        if (s.isEmpty()) {
            return NONE;
        }

        Matcher matcher = INTERVAL_PATTERN.matcher(s);
        if (!(matcher.matches() && matcher.groupCount() == 2)) {
            throw new IllegalArgumentException(s + " is not a valid interval. It must follow the pattern " +
                INTERVAL_PATTERN.pattern());
        }
        return new Interval(Integer.parseInt(matcher.group(1)), Units.fromCode(matcher.group(2)));
    }
Parses the string into an interval. The string must match the regular expression (\d+)(min|hr|d); otherwise,
an exception is thrown.

@param s The string to parse
@return The {@link Interval}
@throws java.lang.IllegalArgumentException if the string does not parse