Class Duration.Builder
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. 
- 
Method SummaryModifier and TypeMethodDescriptionbuild()Creates a new duration conforming to ISO-8601.days(int num)Adds a day item.hours(int num)Adds a hour item.micros(int num)Adds a microsecond item.millis(int num)Adds a millisecond item.minutes(int num)Adds a minute item.months(int num)Adds a month item.nanos(int num)Adds a nanosecond item.seconds(int num)Adds a second item.years(int num)Adds a year item.
- 
Method Details- 
yearsAdds a year item. - Parameters:
- num- count of years- >= 0
- Returns:
- this instance for method chaining
- Throws:
- IllegalArgumentException- if the argument is negative
- IllegalStateException- if already called
- See Also:
- CalendarUnit.YEARS
 
- 
monthsAdds a month item. - Parameters:
- num- count of months- >= 0
- Returns:
- this instance for method chaining
- Throws:
- IllegalArgumentException- if the argument is negative
- IllegalStateException- if already called
- See Also:
- CalendarUnit.MONTHS
 
- 
daysAdds a day item. - Parameters:
- num- count of days- >= 0
- Returns:
- this instance for method chaining
- Throws:
- IllegalArgumentException- if the argument is negative
- IllegalStateException- if already called
- See Also:
- CalendarUnit.DAYS
 
- 
hoursAdds a hour item. - Parameters:
- num- count of hours- >= 0
- Returns:
- this instance for method chaining
- Throws:
- IllegalArgumentException- if the argument is negative
- IllegalStateException- if already called
- See Also:
- ClockUnit.HOURS
 
- 
minutesAdds a minute item. - Parameters:
- num- count of minutes- >= 0
- Returns:
- this instance for method chaining
- Throws:
- IllegalArgumentException- if the argument is negative
- IllegalStateException- if already called
- See Also:
- ClockUnit.MINUTES
 
- 
secondsAdds a second item. - Parameters:
- num- count of seconds- >= 0
- Returns:
- this instance for method chaining
- Throws:
- IllegalArgumentException- if the argument is negative
- IllegalStateException- if already called
- See Also:
- ClockUnit.SECONDS
 
- 
millisAdds a millisecond item. The argument will automatically be normalized to nanoseconds. - Parameters:
- num- count of milliseconds- >= 0
- Returns:
- this instance for method chaining
- Throws:
- IllegalArgumentException- if the argument is negative
- IllegalStateException- if already called
 
- 
microsAdds a microsecond item. The argument will automatically be normalized to nanoseconds. - Parameters:
- num- count of microseconds- >= 0
- Returns:
- this instance for method chaining
- Throws:
- IllegalArgumentException- if the argument is negative
- IllegalStateException- if already called
 
- 
nanosAdds a nanosecond item. - Parameters:
- num- count of nanoseconds- >= 0
- Returns:
- this instance for method chaining
- Throws:
- IllegalArgumentException- if the argument is negative
- IllegalStateException- if already called
- See Also:
- ClockUnit.NANOS
 
- 
buildCreates a new duration conforming to ISO-8601. - Returns:
- new Duration
 
 
-