Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8318571

Add getter methods for Locale and Patterns in ListFormat

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 22
    • core-libs
    • None
    • source
    • minimal
    • New public methods do not introduce backward incompatibility.
    • Java API
    • SE

      Summary

      Add public getter methods to obtain the fields that are used for equality.

      Problem

      There are descriptions for the instance's locale and patterns, but there is no way to obtain them, other than parsing the String from toString().

      Solution

      Add two public methods, getLocale() and getPatterns().

      Specification

      Add the following two methods in ListFormat class:

         /**
           * {@return the {@code Locale} of this ListFormat}
           *
           * The {@code locale} is defined by {@link #getInstance(Locale, Type, Style)} or 
           * {@link #getInstance(String[])}.
           */ 
          public Locale getLocale()
      
          /**
           * {@return the patterns used in this ListFormat}
           *
           * The {@code patterns} are defined by {@link #getInstance(Locale, Type, Style)} or 
           * {@link #getInstance(String[])}.
      */
      public String[] getPatterns()

            naoto Naoto Sato
            naoto Naoto Sato
            Iris Clark, Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: