The InternationalFormatter Class
InternationalFormatter
is a subclass of DefaultFormatter that delegates most of its
work to an object of type java.text.Format (which is always a subclass
since java.text.Format itself is
abstract). Many of these subclasses provide internationalization support through awareness of locales,
hence the name InternationalFormatter.
InternationalFormatter is
rarely used directly. It is a repository for the common functionality of
its two subclasses, DateFormatter and
NumberFormatter.
Properties
Table 20-6 shows
the properties defined by InternationalFormatter.
Table 20-6. InternationalFormatter properties
Property | Data type | get | is | set | Default value |
|---|---|---|---|---|---|
format | java.text.Format | · | · | null | |
minimum | Comparable | · | · | null | |
maximum | Comparable | · | · | null | |
| boolean | · | · | false | |
ooverridden See also properties from the |
The format property is key to InternationalFormatter and is used by the
valueToString( ) and stringToValue( ) methods to translate
between the field’s Object and
String representations. It can be
set in the constructor or via the setFormat(
) method.
The minimum and maximum
properties can constrain the value of the field. If minimum is not null, value may not be less than minimum. If maximum is not null, value may not be greater than maximum. These may be of any type that
implements the Comparable
interface. (Provided it hasn’t already been set, calling setMinimum( ) or setMaximum( ) also sets the formatter’s
valueClass property.) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access