static class Format.BasicFormat extends Object
Format
has only one method for formatting,
Format.format(Object)
, this class provides methods for several
primitive types. To make it easy to combine formatting objects, all
methods write to a PrintWriter
.
The base implementation of most of these methods throws; there
is no requirement that a derived class implements all of these methods.
It is up to Format.parseFormatString(java.lang.String, java.util.List<mondrian.util.Format.BasicFormat>, mondrian.util.Format.FormatType[])
to ensure that, for
example, the format(double,StringBuilder)
method is
never called for DateFormat
.
Modifier and Type | Field and Description |
---|---|
(package private) int |
code |
Constructor and Description |
---|
BasicFormat() |
BasicFormat(int code) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
format(Calendar calendar,
StringBuilder buf) |
(package private) void |
format(Date date,
StringBuilder buf) |
(package private) void |
format(double d,
StringBuilder buf) |
(package private) void |
format(long n,
StringBuilder buf) |
(package private) void |
format(String s,
StringBuilder buf) |
(package private) void |
formatNull(StringBuilder buf) |
(package private) mondrian.util.Format.FormatType |
getFormatType() |
(package private) boolean |
isApplicableTo(double n)
Returns whether this format can handle a given value.
|
(package private) boolean |
isApplicableTo(long n)
Returns whether this format can handle a given value.
|
mondrian.util.Format.FormatType getFormatType()
void formatNull(StringBuilder buf)
void format(double d, StringBuilder buf)
void format(long n, StringBuilder buf)
void format(String s, StringBuilder buf)
void format(Date date, StringBuilder buf)
void format(Calendar calendar, StringBuilder buf)
boolean isApplicableTo(double n)
Usually returns true; one notable exception is a format for negative numbers which causes the number to be underflow to zero and therefore be ineligible for the negative format.
n
- valueboolean isApplicableTo(long n)
Usually returns true; one notable exception is a format for negative numbers which causes the number to be underflow to zero and therefore be ineligible for the negative format.
n
- value