当前位置: 首页>>代码示例>>Java>>正文


Java CalendarDataUtility.retrieveMinimalDaysInFirstWeek方法代码示例

本文整理汇总了Java中sun.util.locale.provider.CalendarDataUtility.retrieveMinimalDaysInFirstWeek方法的典型用法代码示例。如果您正苦于以下问题:Java CalendarDataUtility.retrieveMinimalDaysInFirstWeek方法的具体用法?Java CalendarDataUtility.retrieveMinimalDaysInFirstWeek怎么用?Java CalendarDataUtility.retrieveMinimalDaysInFirstWeek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.util.locale.provider.CalendarDataUtility的用法示例。


在下文中一共展示了CalendarDataUtility.retrieveMinimalDaysInFirstWeek方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setWeekCountData

import sun.util.locale.provider.CalendarDataUtility; //导入方法依赖的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 */
        data = new int[2];
        data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale);
        data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale);
        cachedLocaleData.putIfAbsent(desiredLocale, data);
    }
    firstDayOfWeek = data[0];
    minimalDaysInFirstWeek = data[1];
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:Calendar.java

示例2: of

import sun.util.locale.provider.CalendarDataUtility; //导入方法依赖的package包/类
/**
 * Obtains an instance of {@code WeekFields} appropriate for a locale.
 * <p>
 * This will look up appropriate values from the provider of localization data.
 *
 * @param locale  the locale to use, not null
 * @return the week-definition, not null
 */
public static WeekFields of(Locale locale) {
    Objects.requireNonNull(locale, "locale");
    locale = new Locale(locale.getLanguage(), locale.getCountry());  // elminate variants

    int calDow = CalendarDataUtility.retrieveFirstDayOfWeek(locale);
    DayOfWeek dow = DayOfWeek.SUNDAY.plus(calDow - 1);
    int minDays = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(locale);
    return WeekFields.of(dow, minDays);
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:18,代码来源:WeekFields.java


注:本文中的sun.util.locale.provider.CalendarDataUtility.retrieveMinimalDaysInFirstWeek方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。