本文整理汇总了Java中sun.util.resources.LocaleData.getCalendarData方法的典型用法代码示例。如果您正苦于以下问题:Java LocaleData.getCalendarData方法的具体用法?Java LocaleData.getCalendarData怎么用?Java LocaleData.getCalendarData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.util.resources.LocaleData
的用法示例。
在下文中一共展示了LocaleData.getCalendarData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setWeekCountData
import sun.util.resources.LocaleData; //导入方法依赖的package包/类
/**
* Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
* They are used to figure out the week count for a specific date for
* a given locale. These must be set when a Calendar is constructed.
* @param desiredLocale the given locale.
*/
private void setWeekCountData(Locale desiredLocale)
{
/* try to get the Locale data from the cache */
int[] data = cachedLocaleData.get(desiredLocale);
if (data == null) { /* cache miss */
ResourceBundle bundle = LocaleData.getCalendarData(desiredLocale);
data = new int[2];
data[0] = Integer.parseInt(bundle.getString("firstDayOfWeek"));
data[1] = Integer.parseInt(bundle.getString("minimalDaysInFirstWeek"));
cachedLocaleData.put(desiredLocale, data);
}
firstDayOfWeek = data[0];
minimalDaysInFirstWeek = data[1];
}
示例2: setWeekCountData
import sun.util.resources.LocaleData; //导入方法依赖的package包/类
/**
* Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent.
* They are used to figure out the week count for a specific date for
* a given locale. These must be set when a Calendar is constructed.
* @param desiredLocale the given locale.
*/
private void setWeekCountData(Locale desiredLocale)
{
/* try to get the Locale data from the cache */
int[] data = cachedLocaleData.get(desiredLocale);
if (data == null) { /* cache miss */
ResourceBundle bundle = LocaleData.getCalendarData(desiredLocale);
data = new int[2];
data[0] = Integer.parseInt(bundle.getString("firstDayOfWeek"));
data[1] = Integer.parseInt(bundle.getString("minimalDaysInFirstWeek"));
cachedLocaleData.putIfAbsent(desiredLocale, data);
}
firstDayOfWeek = data[0];
minimalDaysInFirstWeek = data[1];
}