mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8177552: Compact Number Formatting support
Reviewed-by: naoto, rriggs
This commit is contained in:
parent
f3646ad79b
commit
4a28e27fd2
28 changed files with 5157 additions and 196 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -110,4 +110,37 @@ public abstract class NumberFormatProvider extends LocaleServiceProvider {
|
|||
* @see java.text.NumberFormat#getPercentInstance(java.util.Locale)
|
||||
*/
|
||||
public abstract NumberFormat getPercentInstance(Locale locale);
|
||||
|
||||
/**
|
||||
* Returns a new {@code NumberFormat} instance which formats
|
||||
* a number in its compact form for the specified
|
||||
* {@code locale} and {@code formatStyle}.
|
||||
*
|
||||
* @implSpec The default implementation of this method throws
|
||||
* {@code UnSupportedOperationException}. Overriding the implementation
|
||||
* of this method returns the compact number formatter instance
|
||||
* of the given {@code locale} with specified {@code formatStyle}.
|
||||
*
|
||||
* @param locale the desired locale
|
||||
* @param formatStyle the style for formatting a number
|
||||
* @throws NullPointerException if {@code locale} or {@code formatStyle}
|
||||
* is {@code null}
|
||||
* @throws IllegalArgumentException if {@code locale} is not
|
||||
* one of the locales returned from
|
||||
* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
|
||||
* getAvailableLocales()}.
|
||||
* @return a compact number formatter
|
||||
*
|
||||
* @see java.text.NumberFormat#getCompactNumberInstance(Locale,
|
||||
* NumberFormat.Style)
|
||||
* @since 12
|
||||
*/
|
||||
public NumberFormat getCompactNumberInstance(Locale locale,
|
||||
NumberFormat.Style formatStyle) {
|
||||
throw new UnsupportedOperationException(
|
||||
"The " + this.getClass().getName() + " should override this"
|
||||
+ " method to return compact number format instance of "
|
||||
+ locale + " locale and " + formatStyle + " style.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue