1/* GENERATED SOURCE. DO NOT MODIFY. */ 2/**************************************************************************** 3 * Copyright (C) 2000-2014, International Business Machines Corporation and 4 * others. All Rights Reserved. 5 **************************************************************************** 6 */ 7 8package android.icu.text; 9 10import java.util.Locale; 11 12import android.icu.impl.CalendarData; 13import android.icu.util.Calendar; 14import android.icu.util.ChineseCalendar; 15import android.icu.util.ULocale; 16import android.icu.util.ULocale.Category; 17 18/** 19 * A subclass of {@link DateFormatSymbols} for {@link ChineseDateFormat}. 20 * This class contains additional symbols corresponding to the 21 * <code>ChineseCalendar.IS_LEAP_MONTH</code> field. 22 * 23 * @see ChineseDateFormat 24 * @see android.icu.util.ChineseCalendar 25 * @author Alan Liu 26 * @deprecated ICU 50 27 * @hide Only a subset of ICU is exposed in Android 28 */ 29@Deprecated 30public class ChineseDateFormatSymbols extends DateFormatSymbols { 31 // Generated by serialver from JDK 1.4.1_01 32 static final long serialVersionUID = 6827816119783952890L; 33 34 /* 35 * Package-private array that ChineseDateFormat needs to be able to 36 * read. 37 */ 38 String[] isLeapMonth; 39 40 /** 41 * Construct a ChineseDateFormatSymbols for the default <code>FORMAT</code> locale. 42 * @see Category#FORMAT 43 * @deprecated ICU 50 44 */ 45 @Deprecated 46 public ChineseDateFormatSymbols() { 47 this(ULocale.getDefault(Category.FORMAT)); 48 } 49 50 /** 51 * Construct a ChineseDateFormatSymbols for the provided locale. 52 * @param locale the locale 53 * @deprecated ICU 50 54 */ 55 @Deprecated 56 public ChineseDateFormatSymbols(Locale locale) { 57 super(ChineseCalendar.class, ULocale.forLocale(locale)); 58 } 59 60 /** 61 * Construct a ChineseDateFormatSymbols for the provided locale. 62 * @param locale the locale 63 * @deprecated ICU 50 64 */ 65 @Deprecated 66 public ChineseDateFormatSymbols(ULocale locale) { 67 super(ChineseCalendar.class, locale); 68 } 69 70 /** 71 * Construct a ChineseDateFormatSymbols for the provided calendar and locale. 72 * @param cal the Calendar 73 * @param locale the locale 74 * @deprecated ICU 50 75 */ 76 @Deprecated 77 public ChineseDateFormatSymbols(Calendar cal, Locale locale) { 78 // NPE is thrown here when cal is null, like the super class does 79 super(cal.getClass(), locale); 80 } 81 82 /** 83 * Construct a ChineseDateFormatSymbols for the provided calendar and locale. 84 * @param cal the Calendar 85 * @param locale the locale 86 * @deprecated ICU 50 87 */ 88 @Deprecated 89 public ChineseDateFormatSymbols(Calendar cal, ULocale locale) { 90 // NPE is thrown here when cal is null, like the super class does 91 super(cal.getClass(), locale); 92 } 93 94 // New API 95 /** 96 * @deprecated ICU 50 97 */ 98 @Deprecated 99 public String getLeapMonth(int leap) { 100 return isLeapMonth[leap]; 101 } 102 103 /** 104 * {@inheritDoc} 105 * @deprecated ICU 50 106 */ 107 @Deprecated 108 protected void initializeData(ULocale loc, CalendarData calData) { 109 super.initializeData(loc, calData); 110 initializeIsLeapMonth(); 111 } 112 113 void initializeData(DateFormatSymbols dfs) { 114 super.initializeData(dfs); 115 if (dfs instanceof ChineseDateFormatSymbols) { 116 // read-only array, no need to clone 117 this.isLeapMonth = ((ChineseDateFormatSymbols)dfs).isLeapMonth; 118 } else { 119 initializeIsLeapMonth(); 120 } 121 } 122 123 private void initializeIsLeapMonth() { 124 // The old way, obsolete: 125 //isLeapMonth = calData.getStringArray("isLeapMonth"); 126 // The new way to fake this for backward compatibility (no longer used to format/parse): 127 128 isLeapMonth = new String[2]; 129 isLeapMonth[0] = ""; 130 isLeapMonth[1] = (leapMonthPatterns != null)? leapMonthPatterns[DT_LEAP_MONTH_PATTERN_FORMAT_WIDE].replace("{0}", ""): ""; 131 } 132} 133