Top Methods
com.ibm.icu.impl.duration

public Interface PeriodBuilderFactory

Known Direct Implementers
com.ibm.icu.impl.duration.BasicPeriodBuilderFactory
Imports
java.util.TimeZone

Method Summary

Modifier and TypeMethod and Description
public PeriodBuilder

Returns:

a builder
getFixedUnitBuilder
(TimeUnit
the single TimeUnit with which to represent times
unit
)

Returns a builder that represents durations in terms of the single given TimeUnit.

public PeriodBuilder

Returns:

a builder
getMultiUnitBuilder
(int unitCount)

Returns a builder that formats up to the given number of time units, starting with the largest unit less than or equal to the duration.

public PeriodBuilder

Returns:

a builder
getOneOrTwoUnitBuilder
()

Returns a builder that formats the largest one or two time units, starting with the largest period less than or equal to the duration.

public PeriodBuilder

Returns:

a builder
getSingleUnitBuilder
()

Returns a builder that represents durations in terms of the single largest period less than or equal to the duration.

public PeriodBuilderFactory

Returns:

a builder
setAllowMilliseconds
(boolean
whether milliseconds should be allowed.
allow
)

Sets whether milliseconds are allowed.

public PeriodBuilderFactory
setAllowZero(boolean allow)

Sets whether units with a value of zero are represented in a period when 'gaps' appear between time units, e.g. '2 hours, 0 minutes, and 33 seconds'.

public PeriodBuilderFactory

Returns:

this factory
setAvailableUnitRange
(TimeUnit
the smallest time unit available for use
minUnit
,
TimeUnit
the largest time unit available for use
maxUnit
)

Sets the time units available for use.

public PeriodBuilderFactory
setLocale(String localeName)

Sets the locale for the factory.

public PeriodBuilderFactory
setMaxLimit(float maxLimit)

Sets the maximum value for the largest available time unit (as set in setUnits).

public PeriodBuilderFactory
setMinLimit(float minLimit)

Sets the minimum value for the smallest available time unit (as set in setUnits).

public PeriodBuilderFactory

Returns:

a builder
setTimeZone
(TimeZone
the timeZone
timeZone
)

Sets the time zone for the factory.

public PeriodBuilderFactory

Returns:

this factory
setUnitIsAvailable
(TimeUnit
the time unit
unit
,
boolean
true if the unit is available for use
available
)

Sets whether the time unit is available for use.

public PeriodBuilderFactory
setWeeksAloneOnly(boolean aloneOnly)

Sets whether weeks are used with other units, or only when weeks are the only unit.

Method Detail

getFixedUnitBuilderback to summary
public PeriodBuilder getFixedUnitBuilder(TimeUnit unit)

Returns a builder that represents durations in terms of the single given TimeUnit. If the factory settings don't make the given unit available, this will return null.

Parameters
unit:TimeUnit

the single TimeUnit with which to represent times

Returns:PeriodBuilder

a builder

getMultiUnitBuilderback to summary
public PeriodBuilder getMultiUnitBuilder(int unitCount)

Returns a builder that formats up to the given number of time units, starting with the largest unit less than or equal to the duration.

Returns:PeriodBuilder

a builder

getOneOrTwoUnitBuilderback to summary
public PeriodBuilder getOneOrTwoUnitBuilder()

Returns a builder that formats the largest one or two time units, starting with the largest period less than or equal to the duration. It formats two periods if the first period has a count < 2 and the next period has a count >= 1.

Returns:PeriodBuilder

a builder

getSingleUnitBuilderback to summary
public PeriodBuilder getSingleUnitBuilder()

Returns a builder that represents durations in terms of the single largest period less than or equal to the duration.

Returns:PeriodBuilder

a builder

setAllowMillisecondsback to summary
public PeriodBuilderFactory setAllowMilliseconds(boolean allow)

Sets whether milliseconds are allowed. This is only examined when milliseconds are an available field. The default is to allow milliseconds to display normally.

This is intended to be used to set locale-specific behavior. Typically clients will not call this API and instead call setLocale.

Parameters
allow:boolean

whether milliseconds should be allowed.

Returns:PeriodBuilderFactory

a builder

setAllowZeroback to summary
public PeriodBuilderFactory setAllowZero(boolean allow)

Sets whether units with a value of zero are represented in a period when 'gaps' appear between time units, e.g. '2 hours, 0 minutes, and 33 seconds'. Default is to not represent these explicitly ('2 hours and 33 seconds').

setAvailableUnitRangeback to summary
public PeriodBuilderFactory setAvailableUnitRange(TimeUnit minUnit, TimeUnit maxUnit)

Sets the time units available for use. Default is all units.

Parameters
minUnit:TimeUnit

the smallest time unit available for use

maxUnit:TimeUnit

the largest time unit available for use

Returns:PeriodBuilderFactory

this factory

setLocaleback to summary
public PeriodBuilderFactory setLocale(String localeName)

Sets the locale for the factory. Setting the locale can adjust the values for some or all of the other properties to reflect language or cultural conventions. Default is to use the default locale.

setMaxLimitback to summary
public PeriodBuilderFactory setMaxLimit(float maxLimit)

Sets the maximum value for the largest available time unit (as set in setUnits). Periods that represent a longer duration than this will be pinned to this value of that time unit and return true for 'isMoreThan'. Default is no limit. Setting a value of zero restores the default.

setMinLimitback to summary
public PeriodBuilderFactory setMinLimit(float minLimit)

Sets the minimum value for the smallest available time unit (as set in setUnits). Periods that represent a shorter duration than this will be pinned to this value of that time unit and return true for 'isLessThan'. Default is no limit. Setting a value of zero restores the default.

setTimeZoneback to summary
public PeriodBuilderFactory setTimeZone(TimeZone timeZone)

Sets the time zone for the factory. This can affect the timezone used for date computations.

Parameters
timeZone:TimeZone

the timeZone

Returns:PeriodBuilderFactory

a builder

setUnitIsAvailableback to summary
public PeriodBuilderFactory setUnitIsAvailable(TimeUnit unit, boolean available)

Sets whether the time unit is available for use.

Parameters
unit:TimeUnit

the time unit

available:boolean

true if the unit is available for use

Returns:PeriodBuilderFactory

this factory

setWeeksAloneOnlyback to summary
public PeriodBuilderFactory setWeeksAloneOnly(boolean aloneOnly)

Sets whether weeks are used with other units, or only when weeks are the only unit. For example '3 weeks and 2 days' versus '23 days'. Default is to use them alone only.