<i18n dev> RFR 8177552: Compact Number Formatting support

Stephen Colebourne scolebourne at joda.org
Mon Nov 19 14:12:37 UTC 2018


I'm not a big fan of having a class named `Style` as it is commonly used in
business logic. (Yes, its an inner class, but I still think the potential
for annoyance is high). java.time.* has `TextStyle`, but I don't think it
can be reused here. Maybe the class should be honest and called
NumberFormatStyle (as a top level class).

More generally, the API does not allow the caller to take control of the
text, for example to use "mil" as a suffix for million. eg Think of this
method in java.time.* -
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/format/DateTimeFormatterBuilder.html#appendText(java.time.temporal.TemporalField,java.util.Map)


Stephen


On Fri, 16 Nov 2018 at 17:56, Nishit Jain <nishit.jain at oracle.com> wrote:

> Hi,
>
> Please review this non trivial feature addition to NumberFormat API.
>
> The existing NumberFormat API provides locale based support for
> formatting and parsing numbers which includes formatting decimal,
> percent, currency etc, but the support for formatting a number into a
> human readable or compact form is missing. This RFE adds that feature to
> format a decimal number in a compact format (e.g. 1000 -> 1K, 1000000 ->
> 1M in en_US locale) , which is useful for the environment where display
> space is limited, so that the formatted string can be displayed in that
> limited space. It is defined by LDML's specification for Compact Number
> Formats.
>
> http://unicode.org/reports/tr35/tr35-numbers.html#Compact_Number_Formats
>
>
> RFE: https://bugs.openjdk.java.net/browse/JDK-8177552
> Webrev: http://cr.openjdk.java.net/~nishjain/8177552/webrevs/webrev.00/
> CSR: https://bugs.openjdk.java.net/browse/JDK-8188147
>
> Request to please help review the the change.
>
> Regards,
> Nishit Jain
>
>
>
>
>


More information about the core-libs-dev mailing list