Package com.ibm.icu.impl.duration
Class PeriodBuilderImpl
- java.lang.Object
-
- com.ibm.icu.impl.duration.PeriodBuilderImpl
-
- All Implemented Interfaces:
PeriodBuilder
- Direct Known Subclasses:
FixedUnitBuilder
,MultiUnitBuilder
,OneOrTwoUnitBuilder
,SingleUnitBuilder
abstract class PeriodBuilderImpl extends java.lang.Object implements PeriodBuilder
-
-
Field Summary
Fields Modifier and Type Field Description protected BasicPeriodBuilderFactory.Settings
settings
-
Constructor Summary
Constructors Modifier Constructor Description protected
PeriodBuilderImpl(BasicPeriodBuilderFactory.Settings settings)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description long
approximateDurationOf(TimeUnit unit)
Period
create(long duration)
Create a period of the given duration using the current system time as the reference time.Period
createWithReferenceDate(long duration, long referenceDate)
Create a period of the given duration using the provided reference date.protected abstract Period
handleCreate(long duration, long referenceDate, boolean inPast)
PeriodBuilder
withLocale(java.lang.String localeName)
Returns a new PeriodBuilder that uses the provided locale to determine what periods are available for use.protected abstract PeriodBuilder
withSettings(BasicPeriodBuilderFactory.Settings settingsToUse)
PeriodBuilder
withTimeZone(java.util.TimeZone timeZone)
Returns a new PeriodBuilder that computes periods starting at dates in the provided time zone.
-
-
-
Field Detail
-
settings
protected BasicPeriodBuilderFactory.Settings settings
-
-
Constructor Detail
-
PeriodBuilderImpl
protected PeriodBuilderImpl(BasicPeriodBuilderFactory.Settings settings)
-
-
Method Detail
-
create
public Period create(long duration)
Description copied from interface:PeriodBuilder
Create a period of the given duration using the current system time as the reference time.- Specified by:
create
in interfacePeriodBuilder
- Parameters:
duration
- the duration in milliseconds from the current time to the target time. A negative duration indicates a time in the past- Returns:
- a Period that represents the duration
-
approximateDurationOf
public long approximateDurationOf(TimeUnit unit)
-
createWithReferenceDate
public Period createWithReferenceDate(long duration, long referenceDate)
Description copied from interface:PeriodBuilder
Create a period of the given duration using the provided reference date.- Specified by:
createWithReferenceDate
in interfacePeriodBuilder
- Parameters:
duration
- the duration in milliseconds from the referenced time to the target time. A negative duration indicates a time before the reference timereferenceDate
- the reference date from which to compute the period- Returns:
- a Period that represents the duration
-
withTimeZone
public PeriodBuilder withTimeZone(java.util.TimeZone timeZone)
Description copied from interface:PeriodBuilder
Returns a new PeriodBuilder that computes periods starting at dates in the provided time zone.- Specified by:
withTimeZone
in interfacePeriodBuilder
-
withLocale
public PeriodBuilder withLocale(java.lang.String localeName)
Description copied from interface:PeriodBuilder
Returns a new PeriodBuilder that uses the provided locale to determine what periods are available for use.- Specified by:
withLocale
in interfacePeriodBuilder
-
withSettings
protected abstract PeriodBuilder withSettings(BasicPeriodBuilderFactory.Settings settingsToUse)
-
handleCreate
protected abstract Period handleCreate(long duration, long referenceDate, boolean inPast)
-
-