1 /* GENERATED SOURCE. DO NOT MODIFY. */ 2 // © 2016 and later: Unicode, Inc. and others. 3 // License & terms of use: http://www.unicode.org/copyright.html#License 4 /* 5 ****************************************************************************** 6 * Copyright (C) 2007, International Business Machines Corporation and * 7 * others. All Rights Reserved. * 8 ****************************************************************************** 9 */ 10 11 package ohos.global.icu.impl.duration; 12 13 /** 14 * Formats a Period, such as '2 hours 23 minutes'. 15 * The Period defines the fields to format and their 16 * values, and the formatter defines how to format them. 17 * <p> 18 * PeriodFormatters are immutable. 19 * <p> 20 * PeriodFormatter can be instantiated using a PeriodFormatterFactory. 21 * 22 * @see Period 23 * @see PeriodBuilder 24 * @see PeriodFormatterFactory 25 * @hide exposed on OHOS 26 */ 27 public interface PeriodFormatter { 28 /** 29 * Format a Period. 30 * 31 * @param ts the Period to format 32 * @return the formatted time 33 */ format(Period period)34 String format(Period period); 35 36 /** 37 * Return a new PeriodFormatter with the same customizations but 38 * using data for a new locale. Some locales impose limits on the 39 * fields that can be directly formatter. 40 * 41 * @param localeName the name of the new locale 42 * @return a new formatter for the given locale 43 */ withLocale(String localeName)44 PeriodFormatter withLocale(String localeName); 45 } 46