class NumberSpaceQuantityFormat extends QuantityFormat
Modifier and Type | Field and Description |
---|---|
private java.text.NumberFormat |
numberFormat |
private static long |
serialVersionUID |
private javax.measure.format.UnitFormat |
unitFormat |
Constructor and Description |
---|
NumberSpaceQuantityFormat(java.text.NumberFormat numberFormat,
javax.measure.format.UnitFormat unitFormat) |
Modifier and Type | Method and Description |
---|---|
java.lang.Appendable |
format(javax.measure.Quantity<?> quantity,
java.lang.Appendable dest)
Formats the specified quantity into an
Appendable . |
(package private) static int |
getFractionDigitsCount(double d) |
ComparableQuantity<?> |
parse(java.lang.CharSequence csq)
Parses a portion of the specified
CharSequence from the specified position to produce an object. |
(package private) ComparableQuantity<?> |
parse(java.lang.CharSequence csq,
int index)
Parses a portion of the specified
CharSequence from the specified position to produce an object. |
ComparableQuantity<?> |
parse(java.lang.CharSequence csq,
java.text.ParsePosition cursor)
Parses a portion of the specified
CharSequence from the specified position to produce an object. |
format, format, getInstance, getInstance, getInstance, parseObject
private final java.text.NumberFormat numberFormat
private final javax.measure.format.UnitFormat unitFormat
private static final long serialVersionUID
NumberSpaceQuantityFormat(java.text.NumberFormat numberFormat, javax.measure.format.UnitFormat unitFormat)
static int getFractionDigitsCount(double d)
public java.lang.Appendable format(javax.measure.Quantity<?> quantity, java.lang.Appendable dest) throws java.io.IOException
QuantityFormat
Appendable
.format
in class QuantityFormat
quantity
- the quantity to format.dest
- the appendable destination.Appendable
.java.io.IOException
- if an I/O exception occurs.public ComparableQuantity<?> parse(java.lang.CharSequence csq, java.text.ParsePosition cursor) throws java.lang.IllegalArgumentException, javax.measure.format.ParserException
QuantityFormat
CharSequence
from the specified position to produce an object. If parsing succeeds, then the index
of the cursor
argument is updated to the index after the last character used.parse
in class QuantityFormat
csq
- the CharSequence
to parse.cursor
- the cursor holding the current parsing index.java.lang.IllegalArgumentException
- if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).javax.measure.format.ParserException
ComparableQuantity<?> parse(java.lang.CharSequence csq, int index) throws java.lang.IllegalArgumentException, javax.measure.format.ParserException
QuantityFormat
CharSequence
from the specified position to produce an object. If parsing succeeds, then the index
of the cursor
argument is updated to the index after the last character used.parse
in class QuantityFormat
csq
- the CharSequence
to parse.index
- the current parsing index.java.lang.IllegalArgumentException
- if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).javax.measure.format.ParserException
public ComparableQuantity<?> parse(java.lang.CharSequence csq) throws java.lang.IllegalArgumentException, javax.measure.format.ParserException
QuantityFormat
CharSequence
from the specified position to produce an object. If parsing succeeds, then the index
of the cursor
argument is updated to the index after the last character used.parse
in interface tec.uom.lib.common.function.Parser<java.lang.CharSequence,ComparableQuantity>
parse
in class QuantityFormat
csq
- the CharSequence
to parse.java.lang.IllegalArgumentException
- if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).javax.measure.format.ParserException