All Known Implementing Classes:
LocalizedDurationFormatter, Time4jDurationFormatter
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface DurationFormatter
Formats Duration values into localized human-readable strings.

This functional interface defines the contract for converting a Duration into a formatted String, using a specified ChronoUnit as the lower bound of precision. This enables fine-grained control over the formatting of durations, such as "2 hours", "3 minutes", or "1 day, 4 hours", depending on the formatter implementation.

Implementations of this interface may use different localization strategies and formatting libraries. For example, PrettyTimeDurationFormatter uses the Time4J library to generate natural-language strings.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    format(Duration duration, ChronoUnit lowerBound)