Java Code Examples for sun.util.locale.provider.CalendarDataUtility#retrieveJavaTimeFieldValueName()
The following examples show how to use
sun.util.locale.provider.CalendarDataUtility#retrieveJavaTimeFieldValueName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DateTimeTextProvider.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 2
Source File: Bug8007038.java From hottub with GNU General Public License v2.0 | 5 votes |
private static void checkValueRange(String calType, int field, int value, int style, Locale l, boolean isNonNull) { String ret = CalendarDataUtility.retrieveJavaTimeFieldValueName(calType, field, value, style, l); System.out.print("retrieveFieldValueName("+calType+", "+field+", "+value+", "+style+", "+l+")"); if ((ret != null) == isNonNull) { System.out.println(" returned "+ret); } else { throw new RuntimeException("The call returned "+ret); } }
Example 3
Source File: DateTimeTextProvider.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 4
Source File: DateTimeTextProvider.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 5
Source File: Bug8007038.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void checkValueRange(String calType, int field, int value, int style, Locale l, boolean isNonNull) { String ret = CalendarDataUtility.retrieveJavaTimeFieldValueName(calType, field, value, style, l); System.out.print("retrieveFieldValueName("+calType+", "+field+", "+value+", "+style+", "+l+")"); if ((ret != null) == isNonNull) { System.out.println(" returned "+ret); } else { throw new RuntimeException("The call returned "+ret); } }
Example 6
Source File: Bug8007038.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static void checkValueRange(String calType, int field, int value, int style, Locale l, boolean isNonNull) { String ret = CalendarDataUtility.retrieveJavaTimeFieldValueName(calType, field, value, style, l); System.out.print("retrieveFieldValueName("+calType+", "+field+", "+value+", "+style+", "+l+")"); if ((ret != null) == isNonNull) { System.out.println(" returned "+ret); } else { throw new RuntimeException("The call returned "+ret); } }
Example 7
Source File: Bug8007038.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void checkValueRange(String calType, int field, int value, int style, Locale l, boolean isNonNull) { String ret = CalendarDataUtility.retrieveJavaTimeFieldValueName(calType, field, value, style, l); System.out.print("retrieveFieldValueName("+calType+", "+field+", "+value+", "+style+", "+l+")"); if ((ret != null) == isNonNull) { System.out.println(" returned "+ret); } else { throw new RuntimeException("The call returned "+ret); } }
Example 8
Source File: DateTimeTextProvider.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 9
Source File: DateTimeTextProvider.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 10
Source File: Bug8007038.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static void checkValueRange(String calType, int field, int value, int style, Locale l, boolean isNonNull) { String ret = CalendarDataUtility.retrieveJavaTimeFieldValueName(calType, field, value, style, l); System.out.print("retrieveFieldValueName("+calType+", "+field+", "+value+", "+style+", "+l+")"); if ((ret != null) == isNonNull) { System.out.println(" returned "+ret); } else { throw new RuntimeException("The call returned "+ret); } }
Example 11
Source File: Bug8007038.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void checkValueRange(String calType, int field, int value, int style, Locale l, boolean isNonNull) { String ret = CalendarDataUtility.retrieveJavaTimeFieldValueName(calType, field, value, style, l); System.out.print("retrieveFieldValueName("+calType+", "+field+", "+value+", "+style+", "+l+")"); if ((ret != null) == isNonNull) { System.out.println(" returned "+ret); } else { throw new RuntimeException("The call returned "+ret); } }
Example 12
Source File: Bug8007038.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void checkValueRange(String calType, int field, int value, int style, Locale l, boolean isNonNull) { String ret = CalendarDataUtility.retrieveJavaTimeFieldValueName(calType, field, value, style, l); System.out.print("retrieveFieldValueName("+calType+", "+field+", "+value+", "+style+", "+l+")"); if ((ret != null) == isNonNull) { System.out.println(" returned "+ret); } else { throw new RuntimeException("The call returned "+ret); } }
Example 13
Source File: DateTimeTextProvider.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 14
Source File: DateTimeTextProvider.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * 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); }
Example 15
Source File: Bug8007038.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static void checkValueRange(String calType, int field, int value, int style, Locale l, boolean isNonNull) { String ret = CalendarDataUtility.retrieveJavaTimeFieldValueName(calType, field, value, style, l); System.out.print("retrieveFieldValueName("+calType+", "+field+", "+value+", "+style+", "+l+")"); if ((ret != null) == isNonNull) { System.out.println(" returned "+ret); } else { throw new RuntimeException("The call returned "+ret); } }
Example 16
Source File: DateTimeTextProvider.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 17
Source File: Bug8007038.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void checkValueRange(String calType, int field, int value, int style, Locale l, boolean isNonNull) { String ret = CalendarDataUtility.retrieveJavaTimeFieldValueName(calType, field, value, style, l); System.out.print("retrieveFieldValueName("+calType+", "+field+", "+value+", "+style+", "+l+")"); if ((ret != null) == isNonNull) { System.out.println(" returned "+ret); } else { throw new RuntimeException("The call returned "+ret); } }
Example 18
Source File: DateTimeTextProvider.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 19
Source File: Bug8007038.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static void checkValueRange(String calType, int field, int value, int style, Locale l, boolean isNonNull) { String ret = CalendarDataUtility.retrieveJavaTimeFieldValueName(calType, field, value, style, l); System.out.print("retrieveFieldValueName("+calType+", "+field+", "+value+", "+style+", "+l+")"); if ((ret != null) == isNonNull) { System.out.println(" returned "+ret); } else { throw new RuntimeException("The call returned "+ret); } }
Example 20
Source File: DateTimeTextProvider.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * 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); }