Package net.time4j

Class Duration.Builder

Enclosing class:
Duration<U extends IsoUnit>

public static class Duration.Builder extends Object

Builder class for constructing a duration conforming to ISO-8601 which consists of years, months, days and any wall time units.

The week unit is not possible in builder because this unit should be stand-alone according to ISO-8601. A week-based duration can be created by expression Duration.of(amount, CalendarUnit.WEEKS) however.

A builder instance must be created by Duration.ofPositive() or Duration.ofNegative(). Note that the builder is only be designed for single-thread-environments that is always creating a new builder instance per thread.