Package com.ibm.icu.impl
Class DateNumberFormat
- java.lang.Object
-
- java.text.Format
-
- com.ibm.icu.text.UFormat
-
- com.ibm.icu.text.NumberFormat
-
- com.ibm.icu.impl.DateNumberFormat
-
- All Implemented Interfaces:
Serializable,Cloneable
public final class DateNumberFormat extends NumberFormat
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.ibm.icu.text.NumberFormat
NumberFormat.Field, NumberFormat.NumberFormatFactory, NumberFormat.SimpleNumberFormatFactory
-
-
Field Summary
-
Fields inherited from class com.ibm.icu.text.NumberFormat
ACCOUNTINGCURRENCYSTYLE, CASHCURRENCYSTYLE, CURRENCYSTYLE, FRACTION_FIELD, INTEGER_FIELD, INTEGERSTYLE, ISOCURRENCYSTYLE, NUMBERSTYLE, PERCENTSTYLE, PLURALCURRENCYSTYLE, SCIENTIFICSTYLE, STANDARDCURRENCYSTYLE
-
-
Constructor Summary
Constructors Constructor Description DateNumberFormat(ULocale loc, char zeroDigit, String nsName)DateNumberFormat(ULocale loc, String digitString, String nsName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()Overrides clone.booleanequals(Object obj)Overrides equals.StringBufferformat(double number, StringBuffer toAppendTo, FieldPosition pos)Specialization of format.StringBufferformat(long numberL, StringBuffer toAppendTo, FieldPosition pos)Specialization of format.StringBufferformat(BigDecimal number, StringBuffer toAppendTo, FieldPosition pos)Formats an ICU BigDecimal.StringBufferformat(BigDecimal number, StringBuffer toAppendTo, FieldPosition pos)Formats a BigDecimal.StringBufferformat(BigInteger number, StringBuffer toAppendTo, FieldPosition pos)Formats a BigInteger.char[]getDigits()intgetMaximumIntegerDigits()Returns the maximum number of digits allowed in the integer portion of a number.intgetMinimumIntegerDigits()Returns the minimum number of digits allowed in the integer portion of a number.chargetZeroDigit()inthashCode()Overrides hashCode.Numberparse(String text, ParsePosition parsePosition)Returns a Long if possible (e.g., within the range [Long.MIN_VALUE, Long.MAX_VALUE] and with no decimals), otherwise a Double.voidsetMaximumIntegerDigits(int newValue)Sets the maximum number of digits allowed in the integer portion of a number.voidsetMinimumIntegerDigits(int newValue)Sets the minimum number of digits allowed in the integer portion of a number.voidsetParsePositiveOnly(boolean isPositiveOnly)voidsetZeroDigit(char zero)-
Methods inherited from class com.ibm.icu.text.NumberFormat
format, format, format, format, format, format, format, format, getAvailableLocales, getAvailableULocales, getContext, getCurrency, getCurrencyInstance, getCurrencyInstance, getCurrencyInstance, getEffectiveCurrency, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMinimumFractionDigits, getNumberInstance, getNumberInstance, getNumberInstance, getPattern, getPattern, getPercentInstance, getPercentInstance, getPercentInstance, getRoundingMode, getScientificInstance, getScientificInstance, getScientificInstance, isGroupingUsed, isParseIntegerOnly, isParseStrict, parse, parseCurrency, parseObject, registerFactory, setContext, setCurrency, setGroupingUsed, setMaximumFractionDigits, setMinimumFractionDigits, setParseIntegerOnly, setParseStrict, setRoundingMode, unregister
-
Methods inherited from class java.text.Format
format, formatToCharacterIterator, parseObject
-
-
-
-
Method Detail
-
setMaximumIntegerDigits
public void setMaximumIntegerDigits(int newValue)
Description copied from class:NumberFormatSets the maximum number of digits allowed in the integer portion of a number. This must be >= minimumIntegerDigits. If the new value for maximumIntegerDigits is less than the current value of minimumIntegerDigits, then minimumIntegerDigits will also be set to the new value.- Overrides:
setMaximumIntegerDigitsin classNumberFormat- Parameters:
newValue- the maximum number of integer digits to be shown; if less than zero, then zero is used. Subclasses might enforce an upper limit to this value appropriate to the numeric type being formatted.- See Also:
NumberFormat.getMaximumIntegerDigits()
-
getMaximumIntegerDigits
public int getMaximumIntegerDigits()
Description copied from class:NumberFormatReturns the maximum number of digits allowed in the integer portion of a number. The default value is 40, which subclasses can override. When formatting, the exact behavior when this value is exceeded is subclass-specific. When parsing, this has no effect.- Overrides:
getMaximumIntegerDigitsin classNumberFormat- Returns:
- the maximum number of integer digits
- See Also:
NumberFormat.setMaximumIntegerDigits(int)
-
setMinimumIntegerDigits
public void setMinimumIntegerDigits(int newValue)
Description copied from class:NumberFormatSets the minimum number of digits allowed in the integer portion of a number. This must be <= maximumIntegerDigits. If the new value for minimumIntegerDigits is more than the current value of maximumIntegerDigits, then maximumIntegerDigits will also be set to the new value.- Overrides:
setMinimumIntegerDigitsin classNumberFormat- Parameters:
newValue- the minimum number of integer digits to be shown; if less than zero, then zero is used. Subclasses might enforce an upper limit to this value appropriate to the numeric type being formatted.- See Also:
NumberFormat.getMinimumIntegerDigits()
-
getMinimumIntegerDigits
public int getMinimumIntegerDigits()
Description copied from class:NumberFormatReturns the minimum number of digits allowed in the integer portion of a number. The default value is 1, which subclasses can override. When formatting, if this value is not reached, numbers are padded on the left with the locale-specific '0' character to ensure at least this number of integer digits. When parsing, this has no effect.- Overrides:
getMinimumIntegerDigitsin classNumberFormat- Returns:
- the minimum number of integer digits
- See Also:
NumberFormat.setMinimumIntegerDigits(int)
-
setParsePositiveOnly
public void setParsePositiveOnly(boolean isPositiveOnly)
-
getZeroDigit
public char getZeroDigit()
-
setZeroDigit
public void setZeroDigit(char zero)
-
getDigits
public char[] getDigits()
-
format
public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos)
Description copied from class:NumberFormatSpecialization of format.- Specified by:
formatin classNumberFormat- See Also:
Format.format(Object, StringBuffer, FieldPosition)
-
format
public StringBuffer format(long numberL, StringBuffer toAppendTo, FieldPosition pos)
Description copied from class:NumberFormatSpecialization of format.- Specified by:
formatin classNumberFormat- See Also:
Format.format(Object, StringBuffer, FieldPosition)
-
format
public StringBuffer format(BigInteger number, StringBuffer toAppendTo, FieldPosition pos)
Description copied from class:NumberFormatFormats a BigInteger. Specialization of format.- Specified by:
formatin classNumberFormat- See Also:
Format.format(Object, StringBuffer, FieldPosition)
-
format
public StringBuffer format(BigDecimal number, StringBuffer toAppendTo, FieldPosition pos)
Description copied from class:NumberFormatFormats a BigDecimal. Specialization of format.- Specified by:
formatin classNumberFormat- See Also:
Format.format(Object, StringBuffer, FieldPosition)
-
format
public StringBuffer format(BigDecimal number, StringBuffer toAppendTo, FieldPosition pos)
Description copied from class:NumberFormatFormats an ICU BigDecimal. Specialization of format.- Specified by:
formatin classNumberFormat- See Also:
Format.format(Object, StringBuffer, FieldPosition)
-
parse
public Number parse(String text, ParsePosition parsePosition)
Description copied from class:NumberFormatReturns a Long if possible (e.g., within the range [Long.MIN_VALUE, Long.MAX_VALUE] and with no decimals), otherwise a Double. If IntegerOnly is set, will stop at a decimal point (or equivalent; e.g., for rational numbers "1 2/3", will stop after the 1). Does not throw an exception; if no object can be parsed, index is unchanged!- Specified by:
parsein classNumberFormat- See Also:
NumberFormat.isParseIntegerOnly(),Format.parseObject(String, ParsePosition)
-
equals
public boolean equals(Object obj)
Description copied from class:NumberFormatOverrides equals. Two NumberFormats are equal if they are of the same class and the settings (groupingUsed, parseIntegerOnly, maximumIntegerDigits, etc. are equal.- Overrides:
equalsin classNumberFormat- Parameters:
obj- the object to compare against- Returns:
- true if the object is equal to this.
- See Also:
Object.hashCode()
-
hashCode
public int hashCode()
Description copied from class:NumberFormatOverrides hashCode.- Overrides:
hashCodein classNumberFormat- Returns:
- this object's hash code.
- See Also:
Object.equals(java.lang.Object)
-
clone
public Object clone()
Description copied from class:NumberFormatOverrides clone.- Overrides:
clonein classNumberFormat- Returns:
- a shallow copy of this format.
- See Also:
Cloneable
-
-