本文整理汇总了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);
}
示例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"},
};
}
示例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"},
};
}