public class MutablePeriod extends BasePeriod implements ReadWritablePeriod, Cloneable, Serializable
A time period is divided into a number of fields, such as hours and seconds. Which fields are supported is defined by the PeriodType class. The default is the standard period type, which supports years, months, weeks, days, hours, minutes, seconds and millis.
When this time period is added to an instant, the effect is of adding each field in turn.
As a result, this takes into account daylight savings time.
Adding a time period of 1 day to the day before daylight savings starts will only add
23 hours rather than 24 to ensure that the time remains the same.
If this is not the behaviour you want, then see Duration
.
The definition of a period also affects the equals method. A period of 1 day is not equal to a period of 24 hours, nor 1 hour equal to 60 minutes. This is because periods represent an abstracted definition of a time period (eg. a day may not actually be 24 hours, it might be 23 or 25 at daylight savings boundary). To compare the actual duration of two periods, convert both to durations using toDuration, an operation that emphasises that the result may differ according to the date you choose.
MutablePeriod is mutable and not thread-safe, unless concurrent threads are not invoking mutator methods.
Period
,
Serialized FormConstructor and Description |
---|
MutablePeriod()
Creates a zero-length period using the standard period type.
|
MutablePeriod(int hours,
int minutes,
int seconds,
int millis)
Create a period from a set of field values using the standard set of fields.
|
MutablePeriod(int years,
int months,
int weeks,
int days,
int hours,
int minutes,
int seconds,
int millis)
Create a period from a set of field values using the standard set of fields.
|
MutablePeriod(int years,
int months,
int weeks,
int days,
int hours,
int minutes,
int seconds,
int millis,
PeriodType type)
Create a period from a set of field values.
|
MutablePeriod(long duration)
Creates a period from the given millisecond duration using the standard
set of fields.
|
MutablePeriod(long duration,
Chronology chronology)
Creates a period from the given millisecond duration using the standard
set of fields.
|
MutablePeriod(long startInstant,
long endInstant)
Creates a period from the given interval endpoints using the standard
set of fields.
|
MutablePeriod(long startInstant,
long endInstant,
Chronology chrono)
Creates a period from the given interval endpoints using the standard
set of fields.
|
MutablePeriod(long startInstant,
long endInstant,
PeriodType type)
Creates a period from the given interval endpoints.
|
MutablePeriod(long startInstant,
long endInstant,
PeriodType type,
Chronology chrono)
Creates a period from the given interval endpoints.
|
MutablePeriod(long duration,
PeriodType type)
Creates a period from the given millisecond duration.
|
MutablePeriod(long duration,
PeriodType type,
Chronology chronology)
Creates a period from the given millisecond duration.
|
MutablePeriod(Object period)
Creates a period by converting or copying from another object.
|
MutablePeriod(Object period,
Chronology chrono)
Creates a period by converting or copying from another object.
|
MutablePeriod(Object period,
PeriodType type)
Creates a period by converting or copying from another object.
|
MutablePeriod(Object period,
PeriodType type,
Chronology chrono)
Creates a period by converting or copying from another object.
|
MutablePeriod(PeriodType type)
Creates a zero-length period using the specified period type.
|
MutablePeriod(ReadableDuration duration,
ReadableInstant endInstant)
Creates a period from the given duration and end point.
|
MutablePeriod(ReadableDuration duration,
ReadableInstant endInstant,
PeriodType type)
Creates a period from the given duration and end point.
|
MutablePeriod(ReadableInstant startInstant,
ReadableDuration duration)
Creates a period from the given start point and the duration.
|
MutablePeriod(ReadableInstant startInstant,
ReadableDuration duration,
PeriodType type)
Creates a period from the given start point and the duration.
|
MutablePeriod(ReadableInstant startInstant,
ReadableInstant endInstant)
Creates a period from the given interval endpoints using the standard
set of fields.
|
MutablePeriod(ReadableInstant startInstant,
ReadableInstant endInstant,
PeriodType type)
Creates a period from the given interval endpoints.
|
Modifier and Type | Method and Description |
---|---|
void |
add(DurationFieldType field,
int value)
Adds to the value of one of the fields.
|
void |
add(int years,
int months,
int weeks,
int days,
int hours,
int minutes,
int seconds,
int millis)
Adds to each field of this period.
|
void |
add(long duration)
Adds a millisecond duration to this one by dividing the duration into
fields and calling
add(ReadablePeriod) . |
void |
add(long duration,
Chronology chrono)
Adds a millisecond duration to this one by dividing the duration into
fields and calling
add(ReadablePeriod) . |
void |
add(ReadableDuration duration)
Adds a duration to this one by dividing the duration into
fields and calling
add(ReadablePeriod) . |
void |
add(ReadableInterval interval)
Adds an interval to this one by dividing the interval into
fields and calling
add(ReadablePeriod) . |
void |
add(ReadablePeriod period)
Adds a period to this one by adding each field in turn.
|
void |
addDays(int days)
Adds the specified days to the number of days in the period.
|
void |
addHours(int hours)
Adds the specified hours to the number of hours in the period.
|
void |
addMillis(int millis)
Adds the specified millis to the number of millis in the period.
|
void |
addMinutes(int minutes)
Adds the specified minutes to the number of minutes in the period.
|
void |
addMonths(int months)
Adds the specified months to the number of months in the period.
|
void |
addSeconds(int seconds)
Adds the specified seconds to the number of seconds in the period.
|
void |
addWeeks(int weeks)
Adds the specified weeks to the number of weeks in the period.
|
void |
addYears(int years)
Adds the specified years to the number of years in the period.
|
void |
clear()
Clears the period, setting all values back to zero.
|
Object |
clone()
Clone this object.
|
MutablePeriod |
copy()
Clone this object without having to cast the returned object.
|
int |
getDays()
Gets the days field part of the period.
|
int |
getHours()
Gets the hours field part of the period.
|
int |
getMillis()
Gets the millis field part of the period.
|
int |
getMinutes()
Gets the minutes field part of the period.
|
int |
getMonths()
Gets the months field part of the period.
|
int |
getSeconds()
Gets the seconds field part of the period.
|
int |
getWeeks()
Gets the weeks field part of the period.
|
int |
getYears()
Gets the years field part of the period.
|
void |
mergePeriod(ReadablePeriod period)
Merges all the fields from the specified period into this one.
|
static MutablePeriod |
parse(String str)
Parses a
MutablePeriod from the specified string. |
static MutablePeriod |
parse(String str,
PeriodFormatter formatter)
Parses a
MutablePeriod from the specified string using a formatter. |
void |
set(DurationFieldType field,
int value)
Sets the value of one of the fields.
|
void |
setDays(int days)
Sets the number of days of the period.
|
void |
setHours(int hours)
Sets the number of hours of the period.
|
void |
setMillis(int millis)
Sets the number of millis of the period.
|
void |
setMinutes(int minutes)
Sets the number of minutes of the period.
|
void |
setMonths(int months)
Sets the number of months of the period.
|
void |
setPeriod(int years,
int months,
int weeks,
int days,
int hours,
int minutes,
int seconds,
int millis)
Sets all the fields in one go.
|
void |
setPeriod(long duration)
Sets all the fields in one go from a millisecond duration dividing the
fields using the period type.
|
void |
setPeriod(long duration,
Chronology chrono)
Sets all the fields in one go from a millisecond duration.
|
void |
setPeriod(long startInstant,
long endInstant)
Sets all the fields in one go from a millisecond interval using ISOChronology
and dividing the fields using the period type.
|
void |
setPeriod(long startInstant,
long endInstant,
Chronology chrono)
Sets all the fields in one go from a millisecond interval.
|
void |
setPeriod(ReadableDuration duration)
Sets all the fields in one go from a duration dividing the
fields using the period type.
|
void |
setPeriod(ReadableDuration duration,
Chronology chrono)
Sets all the fields in one go from a duration dividing the
fields using the period type.
|
void |
setPeriod(ReadableInstant start,
ReadableInstant end)
Sets all the fields in one go from two instants representing an interval.
|
void |
setPeriod(ReadableInterval interval)
Sets all the fields in one go from an interval using the ISO chronology
and dividing the fields using the period type.
|
void |
setPeriod(ReadablePeriod period)
Sets all the fields in one go from another ReadablePeriod.
|
void |
setSeconds(int seconds)
Sets the number of seconds of the period.
|
void |
setValue(int index,
int value)
Sets the value of one of the fields by index.
|
void |
setWeeks(int weeks)
Sets the number of weeks of the period.
|
void |
setYears(int years)
Sets the number of years of the period.
|
addField, addFieldInto, addPeriod, addPeriodInto, checkPeriodType, getPeriodType, getValue, mergePeriodInto, setField, setFieldInto, setValues, toDurationFrom, toDurationTo
equals, get, getFieldType, getFieldTypes, getValues, hashCode, indexOf, isSupported, size, toMutablePeriod, toPeriod, toString, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
equals, get, getFieldType, getPeriodType, getValue, hashCode, isSupported, size, toMutablePeriod, toPeriod, toString
public MutablePeriod()
public MutablePeriod(PeriodType type)
type
- which set of fields this period supportspublic MutablePeriod(int hours, int minutes, int seconds, int millis)
hours
- amount of hours in this periodminutes
- amount of minutes in this periodseconds
- amount of seconds in this periodmillis
- amount of milliseconds in this periodpublic MutablePeriod(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis)
years
- amount of years in this periodmonths
- amount of months in this periodweeks
- amount of weeks in this perioddays
- amount of days in this periodhours
- amount of hours in this periodminutes
- amount of minutes in this periodseconds
- amount of seconds in this periodmillis
- amount of milliseconds in this periodpublic MutablePeriod(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis, PeriodType type)
years
- amount of years in this period, which must be zero if unsupportedmonths
- amount of months in this period, which must be zero if unsupportedweeks
- amount of weeks in this period, which must be zero if unsupporteddays
- amount of days in this period, which must be zero if unsupportedhours
- amount of hours in this period, which must be zero if unsupportedminutes
- amount of minutes in this period, which must be zero if unsupportedseconds
- amount of seconds in this period, which must be zero if unsupportedmillis
- amount of milliseconds in this period, which must be zero if unsupportedtype
- which set of fields this period supports, null means AllTypeIllegalArgumentException
- if an unsupported field's value is non-zeropublic MutablePeriod(long duration)
Only precise fields in the period type will be used. For the standard period type this is the time fields only. Thus the year, month, week and day fields will not be populated.
If the duration is small, less than one day, then this method will perform as you might expect and split the fields evenly.
If the duration is larger than one day then all the remaining duration will be stored in the largest available precise field, hours in this case.
For example, a duration equal to (365 + 60 + 5) days will be converted to ((365 + 60 + 5) * 24) hours by this constructor.
For more control over the conversion process, you have two options:
Interval
, and from there obtain the period
duration
- the duration, in millisecondspublic MutablePeriod(long duration, PeriodType type)
Only precise fields in the period type will be used. Imprecise fields will not be populated.
If the duration is small then this method will perform as you might expect and split the fields evenly.
If the duration is large then all the remaining duration will be stored in the largest available precise field. For details as to which fields are precise, review the period type javadoc.
duration
- the duration, in millisecondstype
- which set of fields this period supports, null means standardpublic MutablePeriod(long duration, Chronology chronology)
Only precise fields in the period type will be used. Imprecise fields will not be populated.
If the duration is small then this method will perform as you might expect and split the fields evenly.
If the duration is large then all the remaining duration will be stored in the largest available precise field. For details as to which fields are precise, review the period type javadoc.
duration
- the duration, in millisecondschronology
- the chronology to use to split the duration, null means ISO defaultpublic MutablePeriod(long duration, PeriodType type, Chronology chronology)
Only precise fields in the period type will be used. Imprecise fields will not be populated.
If the duration is small then this method will perform as you might expect and split the fields evenly.
If the duration is large then all the remaining duration will be stored in the largest available precise field. For details as to which fields are precise, review the period type javadoc.
duration
- the duration, in millisecondstype
- which set of fields this period supports, null means standardchronology
- the chronology to use to split the duration, null means ISO defaultpublic MutablePeriod(long startInstant, long endInstant)
startInstant
- interval start, in millisecondsendInstant
- interval end, in millisecondspublic MutablePeriod(long startInstant, long endInstant, PeriodType type)
startInstant
- interval start, in millisecondsendInstant
- interval end, in millisecondstype
- which set of fields this period supports, null means standardpublic MutablePeriod(long startInstant, long endInstant, Chronology chrono)
startInstant
- interval start, in millisecondsendInstant
- interval end, in millisecondschrono
- the chronology to use, null means ISO in default zonepublic MutablePeriod(long startInstant, long endInstant, PeriodType type, Chronology chrono)
startInstant
- interval start, in millisecondsendInstant
- interval end, in millisecondstype
- which set of fields this period supports, null means standardchrono
- the chronology to use, null means ISO in default zonepublic MutablePeriod(ReadableInstant startInstant, ReadableInstant endInstant)
The chronology of the start instant is used, unless that is null when the chronology of the end instant is used instead.
startInstant
- interval start, null means nowendInstant
- interval end, null means nowpublic MutablePeriod(ReadableInstant startInstant, ReadableInstant endInstant, PeriodType type)
The chronology of the start instant is used, unless that is null when the chronology of the end instant is used instead.
startInstant
- interval start, null means nowendInstant
- interval end, null means nowtype
- which set of fields this period supports, null means AllTypepublic MutablePeriod(ReadableInstant startInstant, ReadableDuration duration)
startInstant
- the interval start, null means nowduration
- the duration of the interval, null means zero-lengthpublic MutablePeriod(ReadableInstant startInstant, ReadableDuration duration, PeriodType type)
startInstant
- the interval start, null means nowduration
- the duration of the interval, null means zero-lengthtype
- which set of fields this period supports, null means standardpublic MutablePeriod(ReadableDuration duration, ReadableInstant endInstant)
duration
- the duration of the interval, null means zero-lengthendInstant
- the interval end, null means nowpublic MutablePeriod(ReadableDuration duration, ReadableInstant endInstant, PeriodType type)
duration
- the duration of the interval, null means zero-lengthendInstant
- the interval end, null means nowtype
- which set of fields this period supports, null means standardpublic MutablePeriod(Object period)
The recognised object types are defined in
ConverterManager
and
include ReadablePeriod, ReadableInterval and String.
The String formats are described by ISOPeriodFormat.standard()
.
period
- period to convertIllegalArgumentException
- if period is invalidUnsupportedOperationException
- if an unsupported field's value is non-zeropublic MutablePeriod(Object period, PeriodType type)
The recognised object types are defined in
ConverterManager
and
include ReadablePeriod, ReadableInterval and String.
The String formats are described by ISOPeriodFormat.standard()
.
period
- period to converttype
- which set of fields this period supports, null means use converterIllegalArgumentException
- if period is invalidUnsupportedOperationException
- if an unsupported field's value is non-zeropublic MutablePeriod(Object period, Chronology chrono)
The recognised object types are defined in
ConverterManager
and
include ReadablePeriod, ReadableInterval and String.
The String formats are described by ISOPeriodFormat.standard()
.
period
- period to convertchrono
- the chronology to use, null means ISO in default zoneIllegalArgumentException
- if period is invalidUnsupportedOperationException
- if an unsupported field's value is non-zeropublic MutablePeriod(Object period, PeriodType type, Chronology chrono)
The recognised object types are defined in
ConverterManager
and
include ReadablePeriod, ReadableInterval and String.
The String formats are described by ISOPeriodFormat.standard()
.
period
- period to converttype
- which set of fields this period supports, null means use converterchrono
- the chronology to use, null means ISO in default zoneIllegalArgumentException
- if period is invalidUnsupportedOperationException
- if an unsupported field's value is non-zeropublic static MutablePeriod parse(String str)
MutablePeriod
from the specified string.
This uses ISOPeriodFormat.standard()
.
str
- the string to parse, not nullpublic static MutablePeriod parse(String str, PeriodFormatter formatter)
MutablePeriod
from the specified string using a formatter.str
- the string to parse, not nullformatter
- the formatter to use, not nullpublic void clear()
clear
in interface ReadWritablePeriod
public void setValue(int index, int value)
setValue
in interface ReadWritablePeriod
setValue
in class BasePeriod
index
- the field indexvalue
- the new value for the fieldIndexOutOfBoundsException
- if the index is invalidpublic void set(DurationFieldType field, int value)
The field type specified must be one of those that is supported by the period.
set
in interface ReadWritablePeriod
field
- a DurationFieldType instance that is supported by this period, not nullvalue
- the new value for the fieldIllegalArgumentException
- if the field is null or not supportedpublic void setPeriod(ReadablePeriod period)
setPeriod
in interface ReadWritablePeriod
setPeriod
in class BasePeriod
period
- the period to set, null means zero length periodIllegalArgumentException
- if an unsupported field's value is non-zeropublic void setPeriod(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis)
setPeriod
in interface ReadWritablePeriod
setPeriod
in class BasePeriod
years
- amount of years in this period, which must be zero if unsupportedmonths
- amount of months in this period, which must be zero if unsupportedweeks
- amount of weeks in this period, which must be zero if unsupporteddays
- amount of days in this period, which must be zero if unsupportedhours
- amount of hours in this period, which must be zero if unsupportedminutes
- amount of minutes in this period, which must be zero if unsupportedseconds
- amount of seconds in this period, which must be zero if unsupportedmillis
- amount of milliseconds in this period, which must be zero if unsupportedIllegalArgumentException
- if an unsupported field's value is non-zeropublic void setPeriod(ReadableInterval interval)
setPeriod
in interface ReadWritablePeriod
interval
- the interval to set, null means zero lengthArithmeticException
- if the set exceeds the capacity of the periodpublic void setPeriod(ReadableInstant start, ReadableInstant end)
The chronology of the start instant is used, unless that is null when the chronology of the end instant is used instead.
start
- the start instant, null means nowend
- the end instant, null means nowArithmeticException
- if the set exceeds the capacity of the periodpublic void setPeriod(long startInstant, long endInstant)
startInstant
- interval start, in millisecondsendInstant
- interval end, in millisecondsArithmeticException
- if the set exceeds the capacity of the periodpublic void setPeriod(long startInstant, long endInstant, Chronology chrono)
startInstant
- interval start, in millisecondsendInstant
- interval end, in millisecondschrono
- the chronology to use, null means ISO chronologyArithmeticException
- if the set exceeds the capacity of the periodpublic void setPeriod(ReadableDuration duration)
When dividing the duration, only precise fields in the period type will be used. For large durations, all the remaining duration will be stored in the largest available precise field.
duration
- the duration to set, null means zero lengthArithmeticException
- if the set exceeds the capacity of the periodpublic void setPeriod(ReadableDuration duration, Chronology chrono)
When dividing the duration, only precise fields in the period type will be used. For large durations, all the remaining duration will be stored in the largest available precise field.
duration
- the duration to set, null means zero lengthchrono
- the chronology to use, null means ISO defaultArithmeticException
- if the set exceeds the capacity of the periodpublic void setPeriod(long duration)
When dividing the duration, only precise fields in the period type will be used. For large durations, all the remaining duration will be stored in the largest available precise field.
duration
- the duration, in millisecondsArithmeticException
- if the set exceeds the capacity of the periodpublic void setPeriod(long duration, Chronology chrono)
When dividing the duration, only precise fields in the period type will be used. For large durations, all the remaining duration will be stored in the largest available precise field.
duration
- the duration, in millisecondschrono
- the chronology to use, null means ISO chronologyArithmeticException
- if the set exceeds the capacity of the periodpublic void add(DurationFieldType field, int value)
The field type specified must be one of those that is supported by the period.
add
in interface ReadWritablePeriod
field
- a DurationFieldType instance that is supported by this period, not nullvalue
- the value to add to the fieldIllegalArgumentException
- if the field is null or not supportedpublic void add(ReadablePeriod period)
add
in interface ReadWritablePeriod
period
- the period to add, null means add nothingIllegalArgumentException
- if the period being added contains a field
not supported by this periodArithmeticException
- if the addition exceeds the capacity of the periodpublic void add(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis)
add
in interface ReadWritablePeriod
years
- amount of years to add to this period, which must be zero if unsupportedmonths
- amount of months to add to this period, which must be zero if unsupportedweeks
- amount of weeks to add to this period, which must be zero if unsupporteddays
- amount of days to add to this period, which must be zero if unsupportedhours
- amount of hours to add to this period, which must be zero if unsupportedminutes
- amount of minutes to add to this period, which must be zero if unsupportedseconds
- amount of seconds to add to this period, which must be zero if unsupportedmillis
- amount of milliseconds to add to this period, which must be zero if unsupportedIllegalArgumentException
- if the period being added contains a field
not supported by this periodArithmeticException
- if the addition exceeds the capacity of the periodpublic void add(ReadableInterval interval)
add(ReadablePeriod)
.add
in interface ReadWritablePeriod
interval
- the interval to add, null means add nothingArithmeticException
- if the addition exceeds the capacity of the periodpublic void add(ReadableDuration duration)
add(ReadablePeriod)
.duration
- the duration to add, null means add nothingArithmeticException
- if the addition exceeds the capacity of the periodpublic void add(long duration)
add(ReadablePeriod)
.
When dividing the duration, only precise fields in the period type will be used. For large durations, all the remaining duration will be stored in the largest available precise field.
duration
- the duration, in millisecondsArithmeticException
- if the addition exceeds the capacity of the periodpublic void add(long duration, Chronology chrono)
add(ReadablePeriod)
.
When dividing the duration, only precise fields in the period type will be used. For large durations, all the remaining duration will be stored in the largest available precise field.
duration
- the duration, in millisecondschrono
- the chronology to use, null means ISO defaultArithmeticException
- if the addition exceeds the capacity of the periodpublic void mergePeriod(ReadablePeriod period)
Fields that are not present in the specified period are left unaltered.
mergePeriod
in class BasePeriod
period
- the period to set, null ignoredIllegalArgumentException
- if an unsupported field's value is non-zeropublic int getYears()
public int getMonths()
public int getWeeks()
public int getDays()
public int getHours()
public int getMinutes()
public int getSeconds()
public int getMillis()
public void setYears(int years)
setYears
in interface ReadWritablePeriod
years
- the number of yearsIllegalArgumentException
- if field is not supported and the value is non-zeropublic void addYears(int years)
addYears
in interface ReadWritablePeriod
years
- the number of yearsIllegalArgumentException
- if field is not supported and the value is non-zeroArithmeticException
- if the addition exceeds the capacity of the periodpublic void setMonths(int months)
setMonths
in interface ReadWritablePeriod
months
- the number of monthsIllegalArgumentException
- if field is not supported and the value is non-zeropublic void addMonths(int months)
addMonths
in interface ReadWritablePeriod
months
- the number of monthsIllegalArgumentException
- if field is not supported and the value is non-zeroArithmeticException
- if the addition exceeds the capacity of the periodpublic void setWeeks(int weeks)
setWeeks
in interface ReadWritablePeriod
weeks
- the number of weeksIllegalArgumentException
- if field is not supported and the value is non-zeropublic void addWeeks(int weeks)
addWeeks
in interface ReadWritablePeriod
weeks
- the number of weeksIllegalArgumentException
- if field is not supported and the value is non-zeroArithmeticException
- if the addition exceeds the capacity of the periodpublic void setDays(int days)
setDays
in interface ReadWritablePeriod
days
- the number of daysIllegalArgumentException
- if field is not supported and the value is non-zeropublic void addDays(int days)
addDays
in interface ReadWritablePeriod
days
- the number of daysIllegalArgumentException
- if field is not supported and the value is non-zeroArithmeticException
- if the addition exceeds the capacity of the periodpublic void setHours(int hours)
setHours
in interface ReadWritablePeriod
hours
- the number of hoursIllegalArgumentException
- if field is not supported and the value is non-zeropublic void addHours(int hours)
addHours
in interface ReadWritablePeriod
hours
- the number of hoursIllegalArgumentException
- if field is not supported and the value is non-zeroArithmeticException
- if the addition exceeds the capacity of the periodpublic void setMinutes(int minutes)
setMinutes
in interface ReadWritablePeriod
minutes
- the number of minutesIllegalArgumentException
- if field is not supported and the value is non-zeropublic void addMinutes(int minutes)
addMinutes
in interface ReadWritablePeriod
minutes
- the number of minutesIllegalArgumentException
- if field is not supported and the value is non-zeroArithmeticException
- if the addition exceeds the capacity of the periodpublic void setSeconds(int seconds)
setSeconds
in interface ReadWritablePeriod
seconds
- the number of secondsIllegalArgumentException
- if field is not supported and the value is non-zeropublic void addSeconds(int seconds)
addSeconds
in interface ReadWritablePeriod
seconds
- the number of secondsIllegalArgumentException
- if field is not supported and the value is non-zeroArithmeticException
- if the addition exceeds the capacity of the periodpublic void setMillis(int millis)
setMillis
in interface ReadWritablePeriod
millis
- the number of millisIllegalArgumentException
- if field is not supported and the value is non-zeropublic void addMillis(int millis)
addMillis
in interface ReadWritablePeriod
millis
- the number of millisIllegalArgumentException
- if field is not supported and the value is non-zeroArithmeticException
- if the addition exceeds the capacity of the periodpublic MutablePeriod copy()
Copyright © 2002–2022 Joda.org. All rights reserved.