Top Description Inners Fields Constructors Methods
com.ibm.icu.impl.number

public Class LocalizedNumberFormatterAsFormat

extends Format
Class Inheritance
Imports
java.io.Externalizable, .IOException, .ObjectInput, .ObjectOutput, .ObjectStreamException, java.text.AttributedCharacterIterator, .FieldPosition, .Format, .ParsePosition, com.ibm.icu.impl.FormattedStringBuilder, .FormattedValueStringBuilderImpl, .Utility, com.ibm.icu.number.LocalizedNumberFormatter, .NumberFormatter, com.ibm.icu.util.ULocale

A wrapper around LocalizedNumberFormatter implementing the Format interface, enabling improved compatibility with other APIs. This class is serializable.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final transient LocalizedNumberFormatter
private final transient ULocale
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public StringBuffer
format(Object
The object to format
obj
,
StringBuffer
where the text is to be appended
toAppendTo
,
FieldPosition
A FieldPosition identifying a field in the formatted text
pos
)

Implements abstract java.text.Format.format.

Formats a Number using the wrapped LocalizedNumberFormatter.
public AttributedCharacterIterator
formatToCharacterIterator(Object
The object to format
obj
)

Overrides java.text.Format.formatToCharacterIterator.

Formats a Number using the wrapped LocalizedNumberFormatter.
public LocalizedNumberFormatter

Returns:

The unwrapped LocalizedNumberFormatter.
getNumberFormatter
()

Gets the LocalizedNumberFormatter that this wrapper class uses to format numbers.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public Object
parseObject(String
A String, part of which should be parsed.
source
,
ParsePosition
A ParsePosition object with index and error index information as described above.
pos
)

Implements abstract java.text.Format.parseObject.

Not supported.
private Object
Inherited from java.text.Format:
cloneformatparseObject

Field Detail

formatterback to summary
private final transient LocalizedNumberFormatter formatter
localeback to summary
private final transient ULocale locale
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.text.Format.serialVersionUID.

Constructor Detail

LocalizedNumberFormatterAsFormatback to summary
public LocalizedNumberFormatterAsFormat(LocalizedNumberFormatter formatter, ULocale locale)

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
formatback to summary
public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)

Implements abstract java.text.Format.format.

Doc from java.text.Format.format.

Formats a Number using the wrapped LocalizedNumberFormatter. The provided object must be a Number. Formats an object and appends the resulting text to a given string buffer. If the pos argument identifies a field used by the format, then its indices are set to the beginning and end of the first such field encountered.

Parameters
obj:Object

The object to format

toAppendTo:StringBuffer

where the text is to be appended

pos:FieldPosition

A FieldPosition identifying a field in the formatted text

Returns:StringBuffer

the string buffer passed in as toAppendTo, with formatted text appended

Annotations
@Override
formatToCharacterIteratorback to summary
public AttributedCharacterIterator formatToCharacterIterator(Object obj)

Overrides java.text.Format.formatToCharacterIterator.

Doc from java.text.Format.formatToCharacterIterator.

Formats a Number using the wrapped LocalizedNumberFormatter. The provided object must be a Number. Formats an Object producing an AttributedCharacterIterator. You can use the returned AttributedCharacterIterator to build the resulting String, as well as to determine information about the resulting String.

Each attribute key of the AttributedCharacterIterator will be of type Field. It is up to each Format implementation to define what the legal values are for each attribute in the AttributedCharacterIterator, but typically the attribute key is also used as the attribute value.

The default implementation creates an AttributedCharacterIterator with no attributes. Subclasses that support fields should override this and create an AttributedCharacterIterator with meaningful attributes.

Parameters
obj:Object

The object to format

Returns:AttributedCharacterIterator

AttributedCharacterIterator describing the formatted value.

Annotations
@Override
getNumberFormatterback to summary
public LocalizedNumberFormatter getNumberFormatter()

Gets the LocalizedNumberFormatter that this wrapper class uses to format numbers.

Returns:LocalizedNumberFormatter

The unwrapped LocalizedNumberFormatter.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
parseObjectback to summary
public Object parseObject(String source, ParsePosition pos)

Implements abstract java.text.Format.parseObject.

Not supported. This method will throw UnsupportedOperationException.

Parameters
source:String

Doc from java.text.Format.parseObject.

A String, part of which should be parsed.

pos:ParsePosition

Doc from java.text.Format.parseObject.

A ParsePosition object with index and error index information as described above.

Returns:Object

Doc from java.text.Format.parseObject.

An Object parsed from the string. In case of error, returns null.

Annotations
@Override
writeReplaceback to summary
private Object writeReplace() throws ObjectStreamException
com.ibm.icu.impl.number back to summary

pack-priv Class LocalizedNumberFormatterAsFormat.Proxy

extends Object
implements Externalizable
Class Inheritance
  • java.lang.Object
  • com.ibm.icu.impl.number.LocalizedNumberFormatterAsFormat.Proxy
All Implemented Interfaces
java.io.Externalizable, java.io.Serializable

Field Summary

Modifier and TypeField and Description
pack-priv String
private static final long
pack-priv String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
readExternal(ObjectInput
the stream to read data from in order to restore the object
in
)

Implements java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
private Object
public void
writeExternal(ObjectOutput
the stream to write the object to
out
)

Implements java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

languageTagback to summary
pack-priv String languageTag
serialVersionUIDback to summary
private static final long serialVersionUID
skeletonback to summary
pack-priv String skeleton

Constructor Detail

Proxyback to summary
public Proxy()

Method Detail

readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Implements java.io.Externalizable.readExternal.

Doc from java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Parameters
in:ObjectInput

the stream to read data from in order to restore the object

Annotations
@Override
Exceptions
IOException:
if I/O errors occur
ClassNotFoundException:
If the class for an object being restored cannot be found.
readResolveback to summary
private Object readResolve() throws ObjectStreamException
writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Implements java.io.Externalizable.writeExternal.

Doc from java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Parameters
out:ObjectOutput

the stream to write the object to

Annotations
@Override
Exceptions
IOException:
Includes any I/O exceptions that may occur