Java Code Examples for sun.util.locale.provider.LocaleResources#getJavaTimeDateTimePattern()

The following examples show how to use sun.util.locale.provider.LocaleResources#getJavaTimeDateTimePattern() . 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: DateTimeFormatterBuilder.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date, null for time-only pattern
 * @param timeStyle  the FormatStyle for the time, null for date-only pattern
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}
 
Example 2
Source File: DateTimeFormatterBuilder.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date, null for time-only pattern
 * @param timeStyle  the FormatStyle for the time, null for date-only pattern
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}
 
Example 3
Source File: DateTimeFormatterBuilder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date, null for time-only pattern
 * @param timeStyle  the FormatStyle for the time, null for date-only pattern
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}
 
Example 4
Source File: DateTimeFormatterBuilder.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date, null for time-only pattern
 * @param timeStyle  the FormatStyle for the time, null for date-only pattern
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}
 
Example 5
Source File: DateTimeFormatterBuilder.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date, null for time-only pattern
 * @param timeStyle  the FormatStyle for the time, null for date-only pattern
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}
 
Example 6
Source File: DateTimeFormatterBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date, null for time-only pattern
 * @param timeStyle  the FormatStyle for the time, null for date-only pattern
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}
 
Example 7
Source File: DateTimeFormatterBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date, null for time-only pattern
 * @param timeStyle  the FormatStyle for the time, null for date-only pattern
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}
 
Example 8
Source File: DateTimeFormatterBuilder.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date, null for time-only pattern
 * @param timeStyle  the FormatStyle for the time, null for date-only pattern
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}
 
Example 9
Source File: DateTimeFormatterBuilder.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date, null for time-only pattern
 * @param timeStyle  the FormatStyle for the time, null for date-only pattern
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}
 
Example 10
Source File: DateTimeFormatterBuilder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date, null for time-only pattern
 * @param timeStyle  the FormatStyle for the time, null for date-only pattern
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}
 
Example 11
Source File: DateTimeFormatterBuilder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date
 * @param timeStyle  the FormatStyle for the time
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}
 
Example 12
Source File: DateTimeFormatterBuilder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date
 * @param timeStyle  the FormatStyle for the time
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}
 
Example 13
Source File: DateTimeFormatterBuilder.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date, null for time-only pattern
 * @param timeStyle  the FormatStyle for the time, null for date-only pattern
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}
 
Example 14
Source File: DateTimeFormatterBuilder.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date
 * @param timeStyle  the FormatStyle for the time
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}
 
Example 15
Source File: DateTimeFormatterBuilder.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the formatting pattern for date and time styles for a locale and chronology.
 * The locale and chronology are used to lookup the locale specific format
 * for the requested dateStyle and/or timeStyle.
 *
 * @param dateStyle  the FormatStyle for the date
 * @param timeStyle  the FormatStyle for the time
 * @param chrono  the Chronology, non-null
 * @param locale  the locale, non-null
 * @return the locale and Chronology specific formatting pattern
 * @throws IllegalArgumentException if both dateStyle and timeStyle are null
 */
public static String getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
        Chronology chrono, Locale locale) {
    Objects.requireNonNull(locale, "locale");
    Objects.requireNonNull(chrono, "chrono");
    if (dateStyle == null && timeStyle == null) {
        throw new IllegalArgumentException("Either dateStyle or timeStyle must be non-null");
    }
    LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased().getLocaleResources(locale);
    String pattern = lr.getJavaTimeDateTimePattern(
            convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
    return pattern;
}