/** * Convert to object types, returning null if text is null. * * @return converted * @throws StringValueConversionException */ public final Duration toOptionalDuration() throws StringValueConversionException { return (text == null) ? null : toDuration(); }
/** * Convert to object types, returning null if text is null. * * @return converted * @throws StringValueConversionException */ public final Duration toOptionalDuration() throws StringValueConversionException { return (text == null) ? null : toDuration(); }
/** * Convert to primitive types, returning default value if text is null. * * @param defaultValue * the default value to return of text is null * @return the converted text as a primitive or the default if text is null * @throws StringValueConversionException */ public final Duration toDuration(final Duration defaultValue) throws StringValueConversionException { return (text == null) ? defaultValue : toDuration(); }
/** * Convert to primitive types, returning default value if text is null. * * @param defaultValue * the default value to return of text is null * @return the converted text as a primitive or the default if text is null * @throws StringValueConversionException */ public final Duration toDuration(final Duration defaultValue) throws StringValueConversionException { return (text == null) ? defaultValue : toDuration(); }
/** * Convert to object types, returning null if text is null or empty. * * @return converted * @throws StringValueConversionException */ public final Duration toOptionalDuration() throws StringValueConversionException { return Strings.isEmpty(text) ? null : toDuration(); }
/** * @see IValueMap#getDuration(String) */ @Override public final Duration getDuration(final String key) throws StringValueConversionException { return getStringValue(key).toDuration(); }
/** * @see IValueMap#getDuration(String) */ public Duration getDuration(String key) throws StringValueConversionException { return getStringValue(key).toDuration(); }
/** * @see IValueMap#getDuration(String) */ public Duration getDuration(String key) throws StringValueConversionException { return getStringValue(key).toDuration(); }
/** * @see IValueMap#getDuration(String) */ public final Duration getDuration(final String key) throws StringValueConversionException { return getStringValue(key).toDuration(); }
/** * @see IValueMap#getDuration(String) */ public final Duration getDuration(final String key) throws StringValueConversionException { return getStringValue(key).toDuration(); }
/** * Convert to duration, returning default value if text is inconvertible. * * @param defaultValue * the default value * @return the converted text as a duration or the default value if text is empty or * inconvertible * @see Duration#valueOf(String, java.util.Locale) */ public final Duration toDuration(final Duration defaultValue) { if (text != null) { try { return toDuration(); } catch (Exception x) { if (LOG.isDebugEnabled()) { LOG.debug(String.format( "An error occurred while converting '%s' to a Duration: %s", text, x.getMessage()), x); } } } return defaultValue; }
@Override public Duration getDuration(String key) throws StringValueConversionException { return StringValue.valueOf(getKey(key)).toDuration(); }
return (T)toDuration();