Package com.microsoft.kiota
Class PeriodAndDuration
java.lang.Object
com.microsoft.kiota.PeriodAndDuration
- All Implemented Interfaces:
Serializable,Comparable<PeriodAndDuration>,TemporalAmount
public final class PeriodAndDuration
extends Object
implements TemporalAmount, Comparable<PeriodAndDuration>, Serializable
The aggregate type for
Period and Duration - See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PeriodAndDurationA constant for a duration of zero. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(PeriodAndDuration periodAndDuration) booleanChecks if this instance is equal to the specifiedPeriodAndDuration.longget(TemporalUnit unit) Gets the duration section of the type.Gets the period section of the type.getUnits()inthashCode()Gets the hashcode for the object.static PeriodAndDurationCreates an instance based on a period and duration.static PeriodAndDurationofDuration(Duration duration) Creates an instance based on a duration.static PeriodAndDurationCreates an instance based on a period.static PeriodAndDurationofPeriodAndDuration(PeriodAndDuration periodAndDuration) Creates an instance based on a PeriodAndDuration.static PeriodAndDurationParses a string to produce aPeriodAndDuration.subtractFrom(Temporal temporal) toString()Returns a string representation of the instance in the ISO-8601 format 'PnYnMnDTnHnMnS'.
-
Field Details
-
ZERO
A constant for a duration of zero.
-
-
Method Details
-
getPeriod
Gets the period section of the type.- Returns:
- the period section
-
getDuration
Gets the duration section of the type.- Returns:
- the duration section
-
of
Creates an instance based on a period and duration.- Parameters:
period- thePeriod, not nullduration- theDuration, not null- Returns:
- the combined
PeriodAndDuration, not null
-
ofPeriod
Creates an instance based on a period.- Parameters:
period- thePeriod, not null- Returns:
- the combined
PeriodAndDuration, not null
-
ofDuration
Creates an instance based on a duration.- Parameters:
duration- theDuration, not null- Returns:
- the combined
PeriodAndDuration, not null
-
ofPeriodAndDuration
@Nonnull public static PeriodAndDuration ofPeriodAndDuration(@Nonnull PeriodAndDuration periodAndDuration) Creates an instance based on a PeriodAndDuration.- Parameters:
periodAndDuration- thePeriodAndDuration, not null- Returns:
- the combined
PeriodAndDuration, not null
-
parse
Parses a string to produce aPeriodAndDuration.- Parameters:
stringValue- theStringparse from.- Returns:
- parsed instance of
PeriodAndDuration
-
compareTo
- Specified by:
compareToin interfaceComparable<PeriodAndDuration>- Parameters:
periodAndDuration- thePeriodAndDurationfor which to compare to- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
get
- Specified by:
getin interfaceTemporalAmount- Parameters:
unit- theTemporalUnitfor which to return the value- Returns:
- the long value of the unit
-
getUnits
- Specified by:
getUnitsin interfaceTemporalAmount- Returns:
- the List of TemporalUnits; not null
-
addTo
- Specified by:
addToin interfaceTemporalAmount- Parameters:
temporal- the temporal object to add the amount to, not null- Returns:
- an object of the same observable type with the addition made, not null
-
subtractFrom
- Specified by:
subtractFromin interfaceTemporalAmount- Parameters:
temporal- the temporal object to subtract the amount from, not null- Returns:
- an object of the same observable type with the subtraction made, not null
-
toString
Returns a string representation of the instance in the ISO-8601 format 'PnYnMnDTnHnMnS'. -
hashCode
public int hashCode()Gets the hashcode for the object. -
equals
Checks if this instance is equal to the specifiedPeriodAndDuration.
-