public static Duration valueOf(String durationStr) { Matcher matcher = DURATION_PATTERN.matcher(durationStr); if (matcher.matches()) { String doubleStr = matcher.group(DOUBLE_GROUP); String unitStr = matcher.group(UNIT_GROUP); double doubleValue = Double.valueOf(doubleStr); if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) { return buildByMilliseconds(doubleValue); } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) { return buildBySeconds(doubleValue); } else if (unitStr.equalsIgnoreCase("minute")) { return buildByMinutes(doubleValue); } else if (unitStr.equalsIgnoreCase("hour")) { return buildByHours(doubleValue); } else if (unitStr.equalsIgnoreCase("day")) { return buildByDays(doubleValue); } else { throw new IllegalStateException("Unexpected " + unitStr); } } else { throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format."); } }
public static Duration valueOf(String durationStr) { Matcher matcher = DURATION_PATTERN.matcher(durationStr); if (matcher.matches()) { String doubleStr = matcher.group(DOUBLE_GROUP); String unitStr = matcher.group(UNIT_GROUP); double doubleValue = Double.valueOf(doubleStr); if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) { return buildByMilliseconds(doubleValue); } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) { return buildBySeconds(doubleValue); } else if (unitStr.equalsIgnoreCase("minute")) { return buildByMinutes(doubleValue); } else if (unitStr.equalsIgnoreCase("hour")) { return buildByHours(doubleValue); } else if (unitStr.equalsIgnoreCase("day")) { return buildByDays(doubleValue); } else { throw new IllegalStateException("Unexpected " + unitStr); } } else { throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format."); } }
public static Duration valueOf(String durationStr) { Matcher matcher = DURATION_PATTERN.matcher(durationStr); if (matcher.matches()) { String doubleStr = matcher.group(DOUBLE_GROUP); String unitStr = matcher.group(UNIT_GROUP); double doubleValue = Double.valueOf(doubleStr); if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) { return buildByMilliseconds(doubleValue); } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) { return buildBySeconds(doubleValue); } else if (unitStr.equalsIgnoreCase("minute")) { return buildByMinutes(doubleValue); } else if (unitStr.equalsIgnoreCase("hour")) { return buildByHours(doubleValue); } else if (unitStr.equalsIgnoreCase("day")) { return buildByDays(doubleValue); } else { throw new IllegalStateException("Unexpected " + unitStr); } } else { throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format."); } }
public static Duration valueOf(String durationStr) { Matcher matcher = DURATION_PATTERN.matcher(durationStr); if (matcher.matches()) { String doubleStr = matcher.group(DOUBLE_GROUP); String unitStr = matcher.group(UNIT_GROUP); double doubleValue = Double.valueOf(doubleStr); if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) { return buildByMilliseconds(doubleValue); } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) { return buildBySeconds(doubleValue); } else if (unitStr.equalsIgnoreCase("minute")) { return buildByMinutes(doubleValue); } else if (unitStr.equalsIgnoreCase("hour")) { return buildByHours(doubleValue); } else if (unitStr.equalsIgnoreCase("day")) { return buildByDays(doubleValue); } else { throw new IllegalStateException("Unexpected " + unitStr); } } else { throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format."); } }
public static Duration valueOf(String durationStr) { Matcher matcher = DURATION_PATTERN.matcher(durationStr); if (matcher.matches()) { String doubleStr = matcher.group(DOUBLE_GROUP); String unitStr = matcher.group(UNIT_GROUP); double doubleValue = Double.valueOf(doubleStr); if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) { return buildByMilliseconds(doubleValue); } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) { return buildBySeconds(doubleValue); } else if (unitStr.equalsIgnoreCase("minute")) { return buildByMinutes(doubleValue); } else if (unitStr.equalsIgnoreCase("hour")) { return buildByHours(doubleValue); } else if (unitStr.equalsIgnoreCase("day")) { return buildByDays(doubleValue); } else { throw new IllegalStateException("Unexpected " + unitStr); } } else { throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format."); } }
public static Duration valueOf(String durationStr) { Matcher matcher = DURATION_PATTERN.matcher(durationStr); if (matcher.matches()) { String doubleStr = matcher.group(DOUBLE_GROUP); String unitStr = matcher.group(UNIT_GROUP); double doubleValue = Double.valueOf(doubleStr); if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) { return buildByMilliseconds(doubleValue); } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) { return buildBySeconds(doubleValue); } else if (unitStr.equalsIgnoreCase("minute")) { return buildByMinutes(doubleValue); } else if (unitStr.equalsIgnoreCase("hour")) { return buildByHours(doubleValue); } else if (unitStr.equalsIgnoreCase("day")) { return buildByDays(doubleValue); } else { throw new IllegalStateException("Unexpected " + unitStr); } } else { throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format."); } }
public static Duration valueOf(String durationStr) { Matcher matcher = DURATION_PATTERN.matcher(durationStr); if (matcher.matches()) { String doubleStr = matcher.group(DOUBLE_GROUP); String unitStr = matcher.group(UNIT_GROUP); double doubleValue = Double.valueOf(doubleStr); if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) { return buildByMilliseconds(doubleValue); } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) { return buildBySeconds(doubleValue); } else if (unitStr.equalsIgnoreCase("minute")) { return buildByMinutes(doubleValue); } else if (unitStr.equalsIgnoreCase("hour")) { return buildByHours(doubleValue); } else if (unitStr.equalsIgnoreCase("day")) { return buildByDays(doubleValue); } else { throw new IllegalStateException("Unexpected " + unitStr); } } else { throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format."); } }
public static Duration valueOf(String durationStr) { Matcher matcher = DURATION_PATTERN.matcher(durationStr); if (matcher.matches()) { String doubleStr = matcher.group(DOUBLE_GROUP); String unitStr = matcher.group(UNIT_GROUP); double doubleValue = Double.valueOf(doubleStr); if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) { return buildByMilliseconds(doubleValue); } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) { return buildBySeconds(doubleValue); } else if (unitStr.equalsIgnoreCase("minute")) { return buildByMinutes(doubleValue); } else if (unitStr.equalsIgnoreCase("hour")) { return buildByHours(doubleValue); } else if (unitStr.equalsIgnoreCase("day")) { return buildByDays(doubleValue); } else { throw new IllegalStateException("Unexpected " + unitStr); } } else { throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format."); } }
public static Duration valueOf(String durationStr) { Matcher matcher = DURATION_PATTERN.matcher(durationStr); if (matcher.matches()) { String doubleStr = matcher.group(DOUBLE_GROUP); String unitStr = matcher.group(UNIT_GROUP); double doubleValue = Double.valueOf(doubleStr); if (unitStr.equalsIgnoreCase("milli") || unitStr.equalsIgnoreCase("millisecond") || unitStr.length() == 0) { return buildByMilliseconds(doubleValue); } else if (unitStr.equalsIgnoreCase("second") || unitStr.equalsIgnoreCase("seconde")) { return buildBySeconds(doubleValue); } else if (unitStr.equalsIgnoreCase("minute")) { return buildByMinutes(doubleValue); } else if (unitStr.equalsIgnoreCase("hour")) { return buildByHours(doubleValue); } else if (unitStr.equalsIgnoreCase("day")) { return buildByDays(doubleValue); } else { throw new IllegalStateException("Unexpected " + unitStr); } } else { throw new IllegalArgumentException("String value [" + durationStr + "] is not in the expected format."); } }