ChoiceFormat (Java SE 26 & JDK 26)
- All Implemented Interfaces:
Serializable, Cloneable
-
Nested Class Summary
Nested classes/interfaces declared in class NumberFormat
NumberFormat.Field, NumberFormat.Stylestatic classDefines constants that are used as attribute keys in the
AttributedCharacterIteratorreturned fromNumberFormat.formatToCharacterIteratorand as field identifiers inFieldPosition.static enum -
Field Summary
Fields declared in class NumberFormat
static final intField constant used to construct a FieldPosition object.
static final intField constant used to construct a FieldPosition object.
-
Constructor Summary
Constructors
ChoiceFormat(double[] limits, String[] formats) Constructs with the limits and the corresponding formats.
Constructs a ChoiceFormat with limits and corresponding formats based on the pattern.
-
Method Summary
voidApply the given pattern to this ChoiceFormat object.
clone()booleanCompares the specified object with this
ChoiceFormatfor equality.Returns pattern with formatted double.
Specialization of format.
Returns the formats of this ChoiceFormat.
double[]Returns the limits of this ChoiceFormat.
inthashCode()Returns the hash code for this
ChoiceFormat.booleanisStrict()Returns
trueif this format will parse numbers strictly;falseotherwise.static final doublenextDouble(double d) Finds the least double greater than
d.static doublenextDouble(double d, boolean positive) Finds the least double greater than
d(ifpositiveistrue), or the greatest double less thand(ifpositiveisfalse).Parses the input text starting at the index given by the
ParsePositionas aDouble.static final doublepreviousDouble(double d) Finds the greatest double less than
d.voidsetChoices(double[] limits, String[] formats) Set the choices to be used in formatting.
voidsetStrict(boolean strict) Change the leniency value for parsing.
Returns a pattern
stringthat represents thelimitsandformatsof this ChoiceFormat object.toString()Returns a string identifying this
ChoiceFormat, for debugging.Methods declared in class NumberFormat
format, format, format, getAvailableLocales, getCompactNumberInstance, getCompactNumberInstance, getCurrency, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, getRoundingMode, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setCurrency, setGroupingUsed, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setParseIntegerOnly, setRoundingModeSpecialization of format.
Specialization of format.
Formats a number and appends the resulting text to the given string buffer.
Returns an array of all locales for which the
get*Instancemethods of this class can return localized instances.Gets the currency used by this number format when formatting currency values.
Returns a currency format for the current default
FORMATlocale.Returns a currency format for the specified locale.
Returns a general-purpose number format for the current default
FORMATlocale.Returns a general-purpose number format for the specified locale.
Returns an integer number format for the current default
FORMATlocale.Returns an integer number format for the specified locale.
intReturns the maximum number of digits allowed in the fraction portion of a number during formatting.
intReturns the maximum number of digits allowed in the integer portion of a number during formatting.
intReturns the minimum number of digits allowed in the fraction portion of a number during formatting.
intReturns the minimum number of digits allowed in the integer portion of a number during formatting.
Returns a general-purpose number format for the current default
FORMATlocale.Returns a general-purpose number format for the specified locale.
Returns a percentage format for the current default
FORMATlocale.Returns a percentage format for the specified locale.
booleanReturns true if grouping is used in this format.
booleanReturns
trueif this format will parse numbers as integers only.Parses text from the beginning of the given string to produce a
Number.Parses text from the given string to produce an object.
voidSets the currency used by this number format when formatting currency values.
voidSet whether or not grouping will be used in this format.
voidSets the maximum number of digits allowed in the fraction portion of a number during formatting.
voidSets the maximum number of digits allowed in the integer portion of a number during formatting.
voidSets the minimum number of digits allowed in the fraction portion of a number during formatting.
voidSets the minimum number of digits allowed in the integer portion of a number during formatting.
voidSets whether or not numbers should be parsed as integers only.
voidMethods declared in class Format
format, formatToCharacterIterator, parseObjectFormats an object to produce a string.
Formats an Object producing an
AttributedCharacterIterator.Parses text from the beginning of the given string to produce an object.
Methods declared in class Object
finalize, getClass, notify, notifyAll, wait, wait, waitprotected voidDeprecated, for removal: This API element is subject to removal in a future version.
Returns the runtime class of this
Object.final voidWakes up a single thread that is waiting on this object's monitor.
final voidWakes up all threads that are waiting on this object's monitor.
final voidCauses the current thread to wait until it is awakened, typically by being notified or interrupted.
final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
ChoiceFormat
-
ChoiceFormat
-
-
Method Details
-
applyPattern
-
toPattern
-
setChoices
-
getLimits
-
getFormats
-
format
-
format
-
parse
-
isStrict
-
setStrict
-
nextDouble
-
nextDouble
-
previousDouble
-
clone
-
hashCode
-
toString
-
equals
-