2 ******************************************************************************
3 * Copyright (C) 2009, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 ******************************************************************************
8 package com.ibm.icu.impl.duration;
10 import java.util.TimeZone;
13 * Factory used to construct DurationFormatters.
14 * Formatters are immutable once created.
16 * Setters on the factory mutate the factory and return it,
19 public interface DurationFormatterFactory {
22 * Set the period formatter used by the factory. New formatters created
23 * with this factory will use the given period formatter.
25 * @param formatter the formatter to use
26 * @return this DurationFormatterFactory
28 public DurationFormatterFactory setPeriodFormatter(PeriodFormatter formatter);
31 * Set the builder used by the factory. New formatters created
32 * with this factory will use the given locale.
34 * @param builder the builder to use
35 * @return this DurationFormatterFactory
37 public DurationFormatterFactory setPeriodBuilder(PeriodBuilder builder);
40 * Set a fallback formatter for durations over a given limit.
42 * @param fallback the fallback formatter to use, or null
43 * @return this DurationFormatterFactory
45 public DurationFormatterFactory setFallback(DateFormatter fallback);
48 * Set a fallback limit for durations over a given limit.
50 * @param fallbackLimit the fallback limit to use, or 0 if none is desired.
51 * @return this DurationFormatterFactory
53 public DurationFormatterFactory setFallbackLimit(long fallbackLimit);
56 * Set the name of the locale that will be used when
57 * creating new formatters.
59 * @param localeName the name of the Locale
60 * @return this DurationFormatterFactory
62 public DurationFormatterFactory setLocale(String localeName);
65 * Set the name of the locale that will be used when
66 * creating new formatters.
68 * @param timeZone The time zone to set.
69 * @return this DurationFormatterFactory
71 public DurationFormatterFactory setTimeZone(TimeZone timeZone);
74 * Return a formatter based on this factory's current settings.
76 * @return a DurationFormatter
78 public DurationFormatter getFormatter();