本文整理汇总了Java中java.time.chrono.IsoChronology.INSTANCE属性的典型用法代码示例。如果您正苦于以下问题:Java IsoChronology.INSTANCE属性的具体用法?Java IsoChronology.INSTANCE怎么用?Java IsoChronology.INSTANCE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.time.chrono.IsoChronology
的用法示例。
在下文中一共展示了IsoChronology.INSTANCE属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: format
@Override
public boolean format(DateTimePrintContext context, StringBuilder buf) {
Long value = context.getValue(field);
if (value == null) {
return false;
}
String text;
Chronology chrono = context.getTemporal().query(TemporalQueries.chronology());
if (chrono == null || chrono == IsoChronology.INSTANCE) {
text = provider.getText(field, value, textStyle, context.getLocale());
} else {
text = provider.getText(chrono, field, value, textStyle, context.getLocale());
}
if (text == null) {
return numberPrinterParser().format(context, buf);
}
buf.append(text);
return true;
}
示例2: getText
/**
* Gets the text for the specified chrono, field, locale and style
* for the purpose of formatting.
* <p>
* The text associated with the value is returned.
* The null return value should be used if there is no applicable text, or
* if the text would be a numeric representation of the value.
*
* @param chrono the Chronology to get text for, not null
* @param field the field to get text for, not null
* @param value the field value to get text for, not null
* @param style the style to get text for, not null
* @param locale the locale to get text for, not null
* @return the text for the field value, null if no text found
*/
public String getText(Chronology chrono, TemporalField field, long value,
TextStyle style, Locale locale) {
if (chrono == IsoChronology.INSTANCE
|| !(field instanceof ChronoField)) {
return getText(field, value, style, locale);
}
int fieldIndex;
int fieldValue;
if (field == ERA) {
fieldIndex = Calendar.ERA;
if (chrono == JapaneseChronology.INSTANCE) {
if (value == -999) {
fieldValue = 0;
} else {
fieldValue = (int) value + 2;
}
} else {
fieldValue = (int) value;
}
} else if (field == MONTH_OF_YEAR) {
fieldIndex = Calendar.MONTH;
fieldValue = (int) value - 1;
} else if (field == DAY_OF_WEEK) {
fieldIndex = Calendar.DAY_OF_WEEK;
fieldValue = (int) value + 1;
if (fieldValue > 7) {
fieldValue = Calendar.SUNDAY;
}
} else if (field == AMPM_OF_DAY) {
fieldIndex = Calendar.AM_PM;
fieldValue = (int) value;
} else {
return null;
}
return CalendarDataUtility.retrieveJavaTimeFieldValueName(
chrono.getCalendarType(), fieldIndex, fieldValue, style.toCalendarStyle(), locale);
}
示例3: localizedDateTimePatterns
@DataProvider(name="localePatterns")
Object[][] localizedDateTimePatterns() {
return new Object[][] {
{FormatStyle.FULL, FormatStyle.FULL, IsoChronology.INSTANCE, Locale.US, "EEEE, MMMM d, y 'at' h:mm:ss a zzzz"},
{FormatStyle.LONG, FormatStyle.LONG, IsoChronology.INSTANCE, Locale.US, "MMMM d, y 'at' h:mm:ss a z"},
{FormatStyle.MEDIUM, FormatStyle.MEDIUM, IsoChronology.INSTANCE, Locale.US, "MMM d, y, h:mm:ss a"},
{FormatStyle.SHORT, FormatStyle.SHORT, IsoChronology.INSTANCE, Locale.US, "M/d/yy, h:mm a"},
{FormatStyle.FULL, null, IsoChronology.INSTANCE, Locale.US, "EEEE, MMMM d, y"},
{FormatStyle.LONG, null, IsoChronology.INSTANCE, Locale.US, "MMMM d, y"},
{FormatStyle.MEDIUM, null, IsoChronology.INSTANCE, Locale.US, "MMM d, y"},
{FormatStyle.SHORT, null, IsoChronology.INSTANCE, Locale.US, "M/d/yy"},
{null, FormatStyle.FULL, IsoChronology.INSTANCE, Locale.US, "h:mm:ss a zzzz"},
{null, FormatStyle.LONG, IsoChronology.INSTANCE, Locale.US, "h:mm:ss a z"},
{null, FormatStyle.MEDIUM, IsoChronology.INSTANCE, Locale.US, "h:mm:ss a"},
{null, FormatStyle.SHORT, IsoChronology.INSTANCE, Locale.US, "h:mm a"},
};
}
示例4: data_of_calendars
@DataProvider(name = "calendars")
Chronology[][] data_of_calendars() {
return new Chronology[][]{
{HijrahChronology.INSTANCE},
{IsoChronology.INSTANCE},
{JapaneseChronology.INSTANCE},
{MinguoChronology.INSTANCE},
{ThaiBuddhistChronology.INSTANCE},
};
}
示例5: getEffectiveChronology
/**
* Gets the effective chronology during parsing.
*
* @return the effective parsing chronology, not null
*/
Chronology getEffectiveChronology() {
Chronology chrono = currentParsed().chrono;
if (chrono == null) {
chrono = formatter.getChronology();
if (chrono == null) {
chrono = IsoChronology.INSTANCE;
}
}
return chrono;
}
示例6: data_query
@DataProvider(name="query")
Object[][] data_query() {
return new Object[][] {
{TEST_07_15, TemporalQueries.chronology(), IsoChronology.INSTANCE},
{TEST_07_15, TemporalQueries.zoneId(), null},
{TEST_07_15, TemporalQueries.precision(), null},
{TEST_07_15, TemporalQueries.zone(), null},
{TEST_07_15, TemporalQueries.offset(), null},
{TEST_07_15, TemporalQueries.localDate(), null},
{TEST_07_15, TemporalQueries.localTime(), null},
};
}
示例7: data_of_calendars
@DataProvider(name = "calendars")
Chronology[][] data_of_calendars() {
return new Chronology[][]{
{HijrahChronology.INSTANCE},
{IsoChronology.INSTANCE},
{JapaneseChronology.INSTANCE},
{MinguoChronology.INSTANCE},
{ThaiBuddhistChronology.INSTANCE}};
}
示例8: data_CalendarType
@DataProvider(name = "calendarsystemtype")
Object[][] data_CalendarType() {
return new Object[][] {
{HijrahChronology.INSTANCE, "islamic-umalqura"},
{IsoChronology.INSTANCE, "iso8601"},
{JapaneseChronology.INSTANCE, "japanese"},
{MinguoChronology.INSTANCE, "roc"},
{ThaiBuddhistChronology.INSTANCE, "buddhist"},
};
}
示例9: data_query
@DataProvider(name="query")
Object[][] data_query() {
return new Object[][] {
{Month.JUNE, TemporalQueries.chronology(), IsoChronology.INSTANCE},
{Month.JUNE, TemporalQueries.zoneId(), null},
{Month.JUNE, TemporalQueries.precision(), ChronoUnit.MONTHS},
{Month.JUNE, TemporalQueries.zone(), null},
{Month.JUNE, TemporalQueries.offset(), null},
{Month.JUNE, TemporalQueries.localDate(), null},
{Month.JUNE, TemporalQueries.localTime(), null},
};
}
示例10: data_query
@DataProvider(name="query")
Object[][] data_query() {
return new Object[][] {
{TEST_2007_07_15_12_30_40_987654321, TemporalQueries.chronology(), IsoChronology.INSTANCE},
{TEST_2007_07_15_12_30_40_987654321, TemporalQueries.zoneId(), null},
{TEST_2007_07_15_12_30_40_987654321, TemporalQueries.precision(), ChronoUnit.NANOS},
{TEST_2007_07_15_12_30_40_987654321, TemporalQueries.zone(), null},
{TEST_2007_07_15_12_30_40_987654321, TemporalQueries.offset(), null},
{TEST_2007_07_15_12_30_40_987654321, TemporalQueries.localDate(), LocalDate.of(2007, 7, 15)},
{TEST_2007_07_15_12_30_40_987654321, TemporalQueries.localTime(), LocalTime.of(12, 30, 40, 987654321)},
};
}
示例11: data_query
@DataProvider(name="query")
Object[][] data_query() {
return new Object[][] {
{TEST_2008_6_30_11_30_59_000000500, TemporalQueries.chronology(), IsoChronology.INSTANCE},
{TEST_2008_6_30_11_30_59_000000500, TemporalQueries.zoneId(), null},
{TEST_2008_6_30_11_30_59_000000500, TemporalQueries.precision(), ChronoUnit.NANOS},
{TEST_2008_6_30_11_30_59_000000500, TemporalQueries.zone(), OFFSET_PONE},
{TEST_2008_6_30_11_30_59_000000500, TemporalQueries.offset(), OFFSET_PONE},
{TEST_2008_6_30_11_30_59_000000500, TemporalQueries.localDate(), LocalDate.of(2008, 6, 30)},
{TEST_2008_6_30_11_30_59_000000500, TemporalQueries.localTime(), LocalTime.of(11, 30, 59, 500)},
};
}
示例12: getChronology
/**
* Gets the chronology of this period, which is the ISO calendar system.
* <p>
* The {@code Chronology} represents the calendar system in use.
* The ISO-8601 calendar system is the modern civil calendar system used today
* in most of the world. It is equivalent to the proleptic Gregorian calendar
* system, in which today's rules for leap years are applied for all time.
*
* @return the ISO chronology, not null
*/
@Override
public IsoChronology getChronology() {
return IsoChronology.INSTANCE;
}
示例13: getChronology
/**
* Gets the chronology of this date, which is the ISO calendar system.
* <p>
* The {@code Chronology} represents the calendar system in use.
* The ISO-8601 calendar system is the modern civil calendar system used today
* in most of the world. It is equivalent to the proleptic Gregorian calendar
* system, in which today's rules for leap years are applied for all time.
*
* @return the ISO chronology, not null
*/
@Override
public IsoChronology getChronology() {
return IsoChronology.INSTANCE;
}