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


Java TextStyle.NARROW属性代码示例

本文整理汇总了Java中java.time.format.TextStyle.NARROW属性的典型用法代码示例。如果您正苦于以下问题:Java TextStyle.NARROW属性的具体用法?Java TextStyle.NARROW怎么用?Java TextStyle.NARROW使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.time.format.TextStyle的用法示例。


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

示例1: getDisplayName

/**
 * {@inheritDoc}
 *
 * @param style {@inheritDoc}
 * @param locale {@inheritDoc}
 */
@Override
public String getDisplayName(TextStyle style, Locale locale) {
    // If this JapaneseEra is a supplemental one, obtain the name from
    // the era definition.
    if (getValue() > N_ERA_CONSTANTS - ERA_OFFSET) {
        Objects.requireNonNull(locale, "locale");
        return style.asNormal() == TextStyle.NARROW ? getAbbreviation() : getName();
    }

    return new DateTimeFormatterBuilder()
        .appendText(ERA, style)
        .toFormatter(locale)
        .withChronology(JapaneseChronology.INSTANCE)
        .format(this == MEIJI ? MEIJI_6_ISODATE : since);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:JapaneseEra.java

示例2: provider_japaneseEra

@DataProvider(name="print_JapaneseChronology")
Object[][] provider_japaneseEra() {
   return new Object[][] {
        {ERA,           TextStyle.FULL, 2, "Heisei"}, // Note: CLDR doesn't define "wide" Japanese era names.
        {ERA,           TextStyle.SHORT, 2, "Heisei"},
        {ERA,           TextStyle.NARROW, 2, "H"},
   };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:TestTextPrinter.java

示例3: provider_text

@DataProvider(name="parseText")
Object[][] provider_text() {
    return new Object[][] {
        {DAY_OF_WEEK, TextStyle.FULL, 1, "Monday"},
        {DAY_OF_WEEK, TextStyle.FULL, 2, "Tuesday"},
        {DAY_OF_WEEK, TextStyle.FULL, 3, "Wednesday"},
        {DAY_OF_WEEK, TextStyle.FULL, 4, "Thursday"},
        {DAY_OF_WEEK, TextStyle.FULL, 5, "Friday"},
        {DAY_OF_WEEK, TextStyle.FULL, 6, "Saturday"},
        {DAY_OF_WEEK, TextStyle.FULL, 7, "Sunday"},

        {DAY_OF_WEEK, TextStyle.SHORT, 1, "Mon"},
        {DAY_OF_WEEK, TextStyle.SHORT, 2, "Tue"},
        {DAY_OF_WEEK, TextStyle.SHORT, 3, "Wed"},
        {DAY_OF_WEEK, TextStyle.SHORT, 4, "Thu"},
        {DAY_OF_WEEK, TextStyle.SHORT, 5, "Fri"},
        {DAY_OF_WEEK, TextStyle.SHORT, 6, "Sat"},
        {DAY_OF_WEEK, TextStyle.SHORT, 7, "Sun"},

        {MONTH_OF_YEAR, TextStyle.FULL, 1, "January"},
        {MONTH_OF_YEAR, TextStyle.FULL, 12, "December"},

        {MONTH_OF_YEAR, TextStyle.SHORT, 1, "Jan"},
        {MONTH_OF_YEAR, TextStyle.SHORT, 12, "Dec"},

        {QUARTER_OF_YEAR, TextStyle.FULL, 1, "1st quarter"},
        {QUARTER_OF_YEAR, TextStyle.FULL, 2, "2nd quarter"},
        {QUARTER_OF_YEAR, TextStyle.FULL, 3, "3rd quarter"},
        {QUARTER_OF_YEAR, TextStyle.FULL, 4, "4th quarter"},

        {QUARTER_OF_YEAR, TextStyle.SHORT, 1, "Q1"},
        {QUARTER_OF_YEAR, TextStyle.SHORT, 2, "Q2"},
        {QUARTER_OF_YEAR, TextStyle.SHORT, 3, "Q3"},
        {QUARTER_OF_YEAR, TextStyle.SHORT, 4, "Q4"},

        {QUARTER_OF_YEAR, TextStyle.NARROW, 1, "1"},
        {QUARTER_OF_YEAR, TextStyle.NARROW, 2, "2"},
        {QUARTER_OF_YEAR, TextStyle.NARROW, 3, "3"},
        {QUARTER_OF_YEAR, TextStyle.NARROW, 4, "4"},
   };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:41,代码来源:TestTextParser.java


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