java.text.spi.DateFormatProvider Java Examples
The following examples show how to use
java.text.spi.DateFormatProvider.
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: DateFormat.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Creates a DateFormat with the given time and/or date style in the given * locale. * @param timeStyle a value from 0 to 3 indicating the time format, * ignored if flags is 2 * @param dateStyle a value from 0 to 3 indicating the time format, * ignored if flags is 1 * @param flags either 1 for a time format, 2 for a date format, * or 3 for a date/time format * @param loc the locale for the format */ private static DateFormat get(int timeStyle, int dateStyle, int flags, Locale loc) { if ((flags & 1) != 0) { if (timeStyle < 0 || timeStyle > 3) { throw new IllegalArgumentException("Illegal time style " + timeStyle); } } else { timeStyle = -1; } if ((flags & 2) != 0) { if (dateStyle < 0 || dateStyle > 3) { throw new IllegalArgumentException("Illegal date style " + dateStyle); } } else { dateStyle = -1; } LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); DateFormat dateFormat = get(adapter, timeStyle, dateStyle, loc); if (dateFormat == null) { dateFormat = get(LocaleProviderAdapter.forJRE(), timeStyle, dateStyle, loc); } return dateFormat; }
Example #2
Source File: DateFormat.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * Creates a DateFormat with the given time and/or date style in the given * locale. * @param timeStyle a value from 0 to 3 indicating the time format, * ignored if flags is 2 * @param dateStyle a value from 0 to 3 indicating the time format, * ignored if flags is 1 * @param flags either 1 for a time format, 2 for a date format, * or 3 for a date/time format * @param loc the locale for the format */ private static DateFormat get(int timeStyle, int dateStyle, int flags, Locale loc) { if ((flags & 1) != 0) { if (timeStyle < 0 || timeStyle > 3) { throw new IllegalArgumentException("Illegal time style " + timeStyle); } } else { timeStyle = -1; } if ((flags & 2) != 0) { if (dateStyle < 0 || dateStyle > 3) { throw new IllegalArgumentException("Illegal date style " + dateStyle); } } else { dateStyle = -1; } LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); DateFormat dateFormat = get(adapter, timeStyle, dateStyle, loc); if (dateFormat == null) { dateFormat = get(LocaleProviderAdapter.forJRE(), timeStyle, dateStyle, loc); } return dateFormat; }
Example #3
Source File: DateFormat.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Creates a DateFormat with the given time and/or date style in the given * locale. * @param timeStyle a value from 0 to 3 indicating the time format, * ignored if flags is 2 * @param dateStyle a value from 0 to 3 indicating the time format, * ignored if flags is 1 * @param flags either 1 for a time format, 2 for a date format, * or 3 for a date/time format * @param loc the locale for the format */ private static DateFormat get(int timeStyle, int dateStyle, int flags, Locale loc) { if ((flags & 1) != 0) { if (timeStyle < 0 || timeStyle > 3) { throw new IllegalArgumentException("Illegal time style " + timeStyle); } } else { timeStyle = -1; } if ((flags & 2) != 0) { if (dateStyle < 0 || dateStyle > 3) { throw new IllegalArgumentException("Illegal date style " + dateStyle); } } else { dateStyle = -1; } LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); DateFormat dateFormat = get(adapter, timeStyle, dateStyle, loc); if (dateFormat == null) { dateFormat = get(LocaleProviderAdapter.forJRE(), timeStyle, dateStyle, loc); } return dateFormat; }
Example #4
Source File: DateFormat.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Creates a DateFormat with the given time and/or date style in the given * locale. * @param timeStyle a value from 0 to 3 indicating the time format, * ignored if flags is 2 * @param dateStyle a value from 0 to 3 indicating the time format, * ignored if flags is 1 * @param flags either 1 for a time format, 2 for a date format, * or 3 for a date/time format * @param loc the locale for the format */ private static DateFormat get(int timeStyle, int dateStyle, int flags, Locale loc) { if ((flags & 1) != 0) { if (timeStyle < 0 || timeStyle > 3) { throw new IllegalArgumentException("Illegal time style " + timeStyle); } } else { timeStyle = -1; } if ((flags & 2) != 0) { if (dateStyle < 0 || dateStyle > 3) { throw new IllegalArgumentException("Illegal date style " + dateStyle); } } else { dateStyle = -1; } LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); DateFormat dateFormat = get(adapter, timeStyle, dateStyle, loc); if (dateFormat == null) { dateFormat = get(LocaleProviderAdapter.forJRE(), timeStyle, dateStyle, loc); } return dateFormat; }
Example #5
Source File: DateFormat.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Creates a DateFormat with the given time and/or date style in the given * locale. * @param timeStyle a value from 0 to 3 indicating the time format, * ignored if flags is 2 * @param dateStyle a value from 0 to 3 indicating the time format, * ignored if flags is 1 * @param flags either 1 for a time format, 2 for a date format, * or 3 for a date/time format * @param loc the locale for the format */ private static DateFormat get(int timeStyle, int dateStyle, int flags, Locale loc) { if ((flags & 1) != 0) { if (timeStyle < 0 || timeStyle > 3) { throw new IllegalArgumentException("Illegal time style " + timeStyle); } } else { timeStyle = -1; } if ((flags & 2) != 0) { if (dateStyle < 0 || dateStyle > 3) { throw new IllegalArgumentException("Illegal date style " + dateStyle); } } else { dateStyle = -1; } LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); DateFormat dateFormat = get(adapter, timeStyle, dateStyle, loc); if (dateFormat == null) { dateFormat = get(LocaleProviderAdapter.forJRE(), timeStyle, dateStyle, loc); } return dateFormat; }
Example #6
Source File: DateFormat.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Creates a DateFormat with the given time and/or date style in the given * locale. * @param timeStyle a value from 0 to 3 indicating the time format, * ignored if flags is 2 * @param dateStyle a value from 0 to 3 indicating the time format, * ignored if flags is 1 * @param flags either 1 for a time format, 2 for a date format, * or 3 for a date/time format * @param loc the locale for the format */ private static DateFormat get(int timeStyle, int dateStyle, int flags, Locale loc) { if ((flags & 1) != 0) { if (timeStyle < 0 || timeStyle > 3) { throw new IllegalArgumentException("Illegal time style " + timeStyle); } } else { timeStyle = -1; } if ((flags & 2) != 0) { if (dateStyle < 0 || dateStyle > 3) { throw new IllegalArgumentException("Illegal date style " + dateStyle); } } else { dateStyle = -1; } LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); DateFormat dateFormat = get(adapter, timeStyle, dateStyle, loc); if (dateFormat == null) { dateFormat = get(LocaleProviderAdapter.forJRE(), timeStyle, dateStyle, loc); } return dateFormat; }
Example #7
Source File: DateFormat.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Creates a DateFormat with the given time and/or date style in the given * locale. * @param timeStyle a value from 0 to 3 indicating the time format, * ignored if flags is 2 * @param dateStyle a value from 0 to 3 indicating the time format, * ignored if flags is 1 * @param flags either 1 for a time format, 2 for a date format, * or 3 for a date/time format * @param loc the locale for the format */ private static DateFormat get(int timeStyle, int dateStyle, int flags, Locale loc) { if ((flags & 1) != 0) { if (timeStyle < 0 || timeStyle > 3) { throw new IllegalArgumentException("Illegal time style " + timeStyle); } } else { timeStyle = -1; } if ((flags & 2) != 0) { if (dateStyle < 0 || dateStyle > 3) { throw new IllegalArgumentException("Illegal date style " + dateStyle); } } else { dateStyle = -1; } LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); DateFormat dateFormat = get(adapter, timeStyle, dateStyle, loc); if (dateFormat == null) { dateFormat = get(LocaleProviderAdapter.forJRE(), timeStyle, dateStyle, loc); } return dateFormat; }
Example #8
Source File: DateFormat.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Creates a DateFormat with the given time and/or date style in the given * locale. * @param timeStyle a value from 0 to 3 indicating the time format, * ignored if flags is 2 * @param dateStyle a value from 0 to 3 indicating the time format, * ignored if flags is 1 * @param flags either 1 for a time format, 2 for a date format, * or 3 for a date/time format * @param loc the locale for the format */ private static DateFormat get(int timeStyle, int dateStyle, int flags, Locale loc) { if ((flags & 1) != 0) { if (timeStyle < 0 || timeStyle > 3) { throw new IllegalArgumentException("Illegal time style " + timeStyle); } } else { timeStyle = -1; } if ((flags & 2) != 0) { if (dateStyle < 0 || dateStyle > 3) { throw new IllegalArgumentException("Illegal date style " + dateStyle); } } else { dateStyle = -1; } LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); DateFormat dateFormat = get(adapter, timeStyle, dateStyle, loc); if (dateFormat == null) { dateFormat = get(LocaleProviderAdapter.forJRE(), timeStyle, dateStyle, loc); } return dateFormat; }
Example #9
Source File: JSpinner.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static String getDefaultPattern(Locale loc) { LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); LocaleResources lr = adapter.getLocaleResources(loc); if (lr == null) { lr = LocaleProviderAdapter.forJRE().getLocaleResources(loc); } return lr.getDateTimePattern(DateFormat.SHORT, DateFormat.SHORT, null); }
Example #10
Source File: JSpinner.java From Bytecoder with Apache License 2.0 | 5 votes |
private static String getDefaultPattern(Locale loc) { LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); LocaleResources lr = adapter.getLocaleResources(loc); if (lr == null) { lr = LocaleProviderAdapter.forJRE().getLocaleResources(loc); } return lr.getDateTimePattern(DateFormat.SHORT, DateFormat.SHORT, null); }
Example #11
Source File: Bug6989440.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public TestThread() { int which = count++ % 3; switch (which) { case 0 : cls = LocaleNameProvider.class; break; case 1 : cls = TimeZoneNameProvider.class; break; case 2 : cls = DateFormatProvider.class; break; default : throw new AssertionError("Should not reach here"); } }
Example #12
Source File: Bug6989440.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public TestThread() { int which = count++ % 3; switch (which) { case 0 : cls = LocaleNameProvider.class; break; case 1 : cls = TimeZoneNameProvider.class; break; case 2 : cls = DateFormatProvider.class; break; default : throw new AssertionError("Should not reach here"); } }
Example #13
Source File: DateFormat.java From Java8CN with Apache License 2.0 | 5 votes |
private static DateFormat get(LocaleProviderAdapter adapter, int timeStyle, int dateStyle, Locale loc) { DateFormatProvider provider = adapter.getDateFormatProvider(); DateFormat dateFormat; if (timeStyle == -1) { dateFormat = provider.getDateInstance(dateStyle, loc); } else { if (dateStyle == -1) { dateFormat = provider.getTimeInstance(timeStyle, loc); } else { dateFormat = provider.getDateTimeInstance(dateStyle, timeStyle, loc); } } return dateFormat; }
Example #14
Source File: JRELocaleProviderAdapter.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public DateFormatProvider getDateFormatProvider() { if (dateFormatProvider == null) { DateFormatProvider provider = new DateFormatProviderImpl(getAdapterType(), getLanguageTagSet("FormatData")); synchronized (this) { if (dateFormatProvider == null) { dateFormatProvider = provider; } } } return dateFormatProvider; }
Example #15
Source File: DateFormat.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static DateFormat get(LocaleProviderAdapter adapter, int timeStyle, int dateStyle, Locale loc) { DateFormatProvider provider = adapter.getDateFormatProvider(); DateFormat dateFormat; if (timeStyle == -1) { dateFormat = provider.getDateInstance(dateStyle, loc); } else { if (dateStyle == -1) { dateFormat = provider.getTimeInstance(timeStyle, loc); } else { dateFormat = provider.getDateTimeInstance(dateStyle, timeStyle, loc); } } return dateFormat; }
Example #16
Source File: JSpinner.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
private static String getDefaultPattern(Locale loc) { LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); LocaleResources lr = adapter.getLocaleResources(loc); if (lr == null) { lr = LocaleProviderAdapter.forJRE().getLocaleResources(loc); } return lr.getDateTimePattern(DateFormat.SHORT, DateFormat.SHORT, null); }
Example #17
Source File: JSpinner.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static String getDefaultPattern(Locale loc) { LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); LocaleResources lr = adapter.getLocaleResources(loc); if (lr == null) { lr = LocaleProviderAdapter.forJRE().getLocaleResources(loc); } return lr.getDateTimePattern(DateFormat.SHORT, DateFormat.SHORT, null); }
Example #18
Source File: JRELocaleProviderAdapter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public DateFormatProvider getDateFormatProvider() { if (dateFormatProvider == null) { DateFormatProvider provider = new DateFormatProviderImpl(getAdapterType(), getLanguageTagSet("FormatData")); synchronized (this) { if (dateFormatProvider == null) { dateFormatProvider = provider; } } } return dateFormatProvider; }
Example #19
Source File: Bug6989440.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public TestThread() { int which = count++ % 3; switch (which) { case 0 : cls = LocaleNameProvider.class; break; case 1 : cls = TimeZoneNameProvider.class; break; case 2 : cls = DateFormatProvider.class; break; default : throw new AssertionError("Should not reach here"); } }
Example #20
Source File: JSpinner.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static String getDefaultPattern(Locale loc) { LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); LocaleResources lr = adapter.getLocaleResources(loc); if (lr == null) { lr = LocaleProviderAdapter.forJRE().getLocaleResources(loc); } return lr.getDateTimePattern(DateFormat.SHORT, DateFormat.SHORT, null); }
Example #21
Source File: DateFormat.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static DateFormat get(LocaleProviderAdapter adapter, int timeStyle, int dateStyle, Locale loc) { DateFormatProvider provider = adapter.getDateFormatProvider(); DateFormat dateFormat; if (timeStyle == -1) { dateFormat = provider.getDateInstance(dateStyle, loc); } else { if (dateStyle == -1) { dateFormat = provider.getTimeInstance(timeStyle, loc); } else { dateFormat = provider.getDateTimeInstance(dateStyle, timeStyle, loc); } } return dateFormat; }
Example #22
Source File: Bug6989440.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public TestThread() { int which = count++ % 3; switch (which) { case 0 : cls = LocaleNameProvider.class; break; case 1 : cls = TimeZoneNameProvider.class; break; case 2 : cls = DateFormatProvider.class; break; default : throw new AssertionError("Should not reach here"); } }
Example #23
Source File: DateFormat.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static DateFormat get(LocaleProviderAdapter adapter, int timeStyle, int dateStyle, Locale loc) { DateFormatProvider provider = adapter.getDateFormatProvider(); DateFormat dateFormat; if (timeStyle == -1) { dateFormat = provider.getDateInstance(dateStyle, loc); } else { if (dateStyle == -1) { dateFormat = provider.getTimeInstance(timeStyle, loc); } else { dateFormat = provider.getDateTimeInstance(dateStyle, timeStyle, loc); } } return dateFormat; }
Example #24
Source File: JSpinner.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static String getDefaultPattern(Locale loc) { LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); LocaleResources lr = adapter.getLocaleResources(loc); if (lr == null) { lr = LocaleProviderAdapter.forJRE().getLocaleResources(loc); } return lr.getDateTimePattern(DateFormat.SHORT, DateFormat.SHORT, null); }
Example #25
Source File: Bug6989440.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public TestThread() { int which = count++ % 3; switch (which) { case 0 : cls = LocaleNameProvider.class; break; case 1 : cls = TimeZoneNameProvider.class; break; case 2 : cls = DateFormatProvider.class; break; default : throw new AssertionError("Should not reach here"); } }
Example #26
Source File: DateFormat.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static DateFormat get(LocaleProviderAdapter adapter, int timeStyle, int dateStyle, Locale loc) { DateFormatProvider provider = adapter.getDateFormatProvider(); DateFormat dateFormat; if (timeStyle == -1) { dateFormat = provider.getDateInstance(dateStyle, loc); } else { if (dateStyle == -1) { dateFormat = provider.getTimeInstance(timeStyle, loc); } else { dateFormat = provider.getDateTimeInstance(dateStyle, timeStyle, loc); } } return dateFormat; }
Example #27
Source File: DateFormat.java From Bytecoder with Apache License 2.0 | 5 votes |
private static DateFormat get(LocaleProviderAdapter adapter, int timeStyle, int dateStyle, Locale loc) { DateFormatProvider provider = adapter.getDateFormatProvider(); DateFormat dateFormat; if (timeStyle == -1) { dateFormat = provider.getDateInstance(dateStyle, loc); } else { if (dateStyle == -1) { dateFormat = provider.getTimeInstance(timeStyle, loc); } else { dateFormat = provider.getDateTimeInstance(dateStyle, timeStyle, loc); } } return dateFormat; }
Example #28
Source File: JSpinner.java From JDKSourceCode1.8 with MIT License | 5 votes |
private static String getDefaultPattern(Locale loc) { LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); LocaleResources lr = adapter.getLocaleResources(loc); if (lr == null) { lr = LocaleProviderAdapter.forJRE().getLocaleResources(loc); } return lr.getDateTimePattern(DateFormat.SHORT, DateFormat.SHORT, null); }
Example #29
Source File: JSpinner.java From Java8CN with Apache License 2.0 | 5 votes |
private static String getDefaultPattern(Locale loc) { LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); LocaleResources lr = adapter.getLocaleResources(loc); if (lr == null) { lr = LocaleProviderAdapter.forJRE().getLocaleResources(loc); } return lr.getDateTimePattern(DateFormat.SHORT, DateFormat.SHORT, null); }
Example #30
Source File: JSpinner.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static String getDefaultPattern(Locale loc) { LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, loc); LocaleResources lr = adapter.getLocaleResources(loc); if (lr == null) { lr = LocaleProviderAdapter.forJRE().getLocaleResources(loc); } return lr.getDateTimePattern(DateFormat.SHORT, DateFormat.SHORT, null); }