Top Description Fields Constructors Methods
com.ibm.icu.impl.duration

pack-priv Class BasicDurationFormatterFactory

extends Object
implements DurationFormatterFactory
Class Inheritance
All Implemented Interfaces
com.ibm.icu.impl.duration.DurationFormatterFactory
Imports
java.util.Locale, .TimeZone

Abstract factory object used to create DurationFormatters. DurationFormatters are immutable once created.

Setters on the factory mutate the factory and return it, for chaining.

Subclasses override getFormatter to return a custom DurationFormatter.

Field Summary

Modifier and TypeField and Description
private PeriodBuilder
private BasicDurationFormatter
f

private DateFormatter
private long
private PeriodFormatter
private String
private BasicPeriodFormatterService
private TimeZone

Constructor Summary

AccessConstructor and Description
pack-priv
BasicDurationFormatterFactory(BasicPeriodFormatterService ps)

Create a default formatter for the current locale and time zone.

Method Summary

Modifier and TypeMethod and Description
protected BasicDurationFormatter
createFormatter()

Create the formatter.

public DateFormatter

Returns:

the fallback formatter, or null if there is no fallback formatter
getFallback
()

Return the current fallback formatter.

public long

Returns:

the limit, or 0 if there is no fallback.
getFallbackLimit
()

Return the current fallback formatter limit

public DurationFormatter

Returns:

a BasicDurationFormatter
getFormatter
()

Implements com.ibm.icu.impl.duration.DurationFormatterFactory.getFormatter.

Return a formatter based on this factory's current settings.
public String

Returns:

the current locale name
getLocaleName
()

Return the current locale name.

public PeriodBuilder

Returns:

the current builder
getPeriodBuilder
()

Return the current builder.

public PeriodFormatter

Returns:

the current period formatter
getPeriodFormatter
()

Return the current period formatter.

public TimeZone

Returns:

the current locale name
getTimeZone
()

Return the current locale name.

protected void
reset()

Clear the cached formatter.

public DurationFormatterFactory

Returns:

this BasicDurationFormatterFactory
setFallback
(DateFormatter
the fallback formatter to use, or null
fallback
)

Implements com.ibm.icu.impl.duration.DurationFormatterFactory.setFallback.

Set a fallback formatter for durations over a given limit.
public DurationFormatterFactory

Returns:

this BasicDurationFormatterFactory
setFallbackLimit
(long
the fallback limit to use, or 0 if none is desired.
fallbackLimit
)

Implements com.ibm.icu.impl.duration.DurationFormatterFactory.setFallbackLimit.

Set a fallback limit for durations over a given limit.
public DurationFormatterFactory

Returns:

this BasicDurationFormatterFactory
setLocale
(String
the name of the Locale
localeName
)

Implements com.ibm.icu.impl.duration.DurationFormatterFactory.setLocale.

Set the name of the locale that will be used when creating new formatters.
public DurationFormatterFactory

Returns:

this BasicDurationFormatterFactory
setPeriodBuilder
(PeriodBuilder
the builder to use
builder
)

Implements com.ibm.icu.impl.duration.DurationFormatterFactory.setPeriodBuilder.

Set the builder used by the factory.
public DurationFormatterFactory

Returns:

this BasicDurationFormatterFactory
setPeriodFormatter
(PeriodFormatter
the formatter to use
formatter
)

Implements com.ibm.icu.impl.duration.DurationFormatterFactory.setPeriodFormatter.

Set the period formatter used by the factory.
public DurationFormatterFactory

Returns:

this BasicDurationFormatterFactory
setTimeZone
(TimeZone
The time zone to use.
timeZone
)

Implements com.ibm.icu.impl.duration.DurationFormatterFactory.setTimeZone.

Set the name of the locale that will be used when creating new formatters.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

builderback to summary
private PeriodBuilder builder
fback to summary
private BasicDurationFormatter f
fallbackback to summary
private DateFormatter fallback
fallbackLimitback to summary
private long fallbackLimit
formatterback to summary
private PeriodFormatter formatter
localeNameback to summary
private String localeName
psback to summary
private BasicPeriodFormatterService ps
timeZoneback to summary
private TimeZone timeZone

Constructor Detail

BasicDurationFormatterFactoryback to summary
pack-priv BasicDurationFormatterFactory(BasicPeriodFormatterService ps)

Create a default formatter for the current locale and time zone.

Method Detail

createFormatterback to summary
protected BasicDurationFormatter createFormatter()

Create the formatter. All local fields are already initialized.

getFallbackback to summary
public DateFormatter getFallback()

Return the current fallback formatter.

Returns:DateFormatter

the fallback formatter, or null if there is no fallback formatter

getFallbackLimitback to summary
public long getFallbackLimit()

Return the current fallback formatter limit

Returns:long

the limit, or 0 if there is no fallback.

getFormatterback to summary
public DurationFormatter getFormatter()

Implements com.ibm.icu.impl.duration.DurationFormatterFactory.getFormatter.

Return a formatter based on this factory's current settings.

Returns:DurationFormatter

a BasicDurationFormatter

Annotations
@Override
getLocaleNameback to summary
public String getLocaleName()

Return the current locale name.

Returns:String

the current locale name

getPeriodBuilderback to summary
public PeriodBuilder getPeriodBuilder()

Return the current builder.

Returns:PeriodBuilder

the current builder

getPeriodFormatterback to summary
public PeriodFormatter getPeriodFormatter()

Return the current period formatter.

Returns:PeriodFormatter

the current period formatter

getTimeZoneback to summary
public TimeZone getTimeZone()

Return the current locale name.

Returns:TimeZone

the current locale name

resetback to summary
protected void reset()

Clear the cached formatter. Subclasses must call this if their state has changed. This is automatically invoked by setBuilder, setFormatter, setFallback, setLocaleName, and setTimeZone

setFallbackback to summary
public DurationFormatterFactory setFallback(DateFormatter fallback)

Implements com.ibm.icu.impl.duration.DurationFormatterFactory.setFallback.

Set a fallback formatter for durations over a given limit.

Parameters
fallback:DateFormatter

the fallback formatter to use, or null

Returns:DurationFormatterFactory

this BasicDurationFormatterFactory

Annotations
@Override
setFallbackLimitback to summary
public DurationFormatterFactory setFallbackLimit(long fallbackLimit)

Implements com.ibm.icu.impl.duration.DurationFormatterFactory.setFallbackLimit.

Set a fallback limit for durations over a given limit.

Parameters
fallbackLimit:long

the fallback limit to use, or 0 if none is desired.

Returns:DurationFormatterFactory

this BasicDurationFormatterFactory

Annotations
@Override
setLocaleback to summary
public DurationFormatterFactory setLocale(String localeName)

Implements com.ibm.icu.impl.duration.DurationFormatterFactory.setLocale.

Set the name of the locale that will be used when creating new formatters.

Parameters
localeName:String

the name of the Locale

Returns:DurationFormatterFactory

this BasicDurationFormatterFactory

Annotations
@Override
setPeriodBuilderback to summary
public DurationFormatterFactory setPeriodBuilder(PeriodBuilder builder)

Implements com.ibm.icu.impl.duration.DurationFormatterFactory.setPeriodBuilder.

Set the builder used by the factory. New formatters created with this factory will use the given locale.

Parameters
builder:PeriodBuilder

the builder to use

Returns:DurationFormatterFactory

this BasicDurationFormatterFactory

Annotations
@Override
setPeriodFormatterback to summary
public DurationFormatterFactory setPeriodFormatter(PeriodFormatter formatter)

Implements com.ibm.icu.impl.duration.DurationFormatterFactory.setPeriodFormatter.

Set the period formatter used by the factory. New formatters created with this factory will use the given period formatter.

Parameters
formatter:PeriodFormatter

Doc from com.ibm.icu.impl.duration.DurationFormatterFactory.setPeriodFormatter.

the formatter to use

Returns:DurationFormatterFactory

this BasicDurationFormatterFactory

Annotations
@Override
setTimeZoneback to summary
public DurationFormatterFactory setTimeZone(TimeZone timeZone)

Implements com.ibm.icu.impl.duration.DurationFormatterFactory.setTimeZone.

Set the name of the locale that will be used when creating new formatters.

Parameters
timeZone:TimeZone

The time zone to use.

Returns:DurationFormatterFactory

this BasicDurationFormatterFactory

Annotations
@Override