public abstract class QuantityFormat extends Object implements tec.uom.lib.common.function.Parser<CharSequence,javax.measure.Quantity>
This class provides the interface for formatting and parsing quantities.
Instances of this class should be able to format quantities stated in CompoundUnit. See formatCompound(...).
| Constructor and Description |
|---|
QuantityFormat() |
| Modifier and Type | Method and Description |
|---|---|
String |
format(javax.measure.Quantity q)
Formats an object to produce a string.
|
abstract Appendable |
format(javax.measure.Quantity<?> quantity,
Appendable dest)
Formats the specified quantity into an
Appendable. |
StringBuilder |
format(javax.measure.Quantity<?> q,
StringBuilder dest)
Convenience method equivalent to
#format(AbstractQuantity, Appendable) except it does not raise an IOException. |
static QuantityFormat |
getInstance()
Returns the quantity format for the default locale.
|
public QuantityFormat()
public static QuantityFormat getInstance()
Unit
separated by whitespace(s).MeasureFormat.getInstance(NumberFormat.getInstance(), UnitFormat.getInstance())public abstract Appendable format(javax.measure.Quantity<?> quantity, Appendable dest) throws IOException
Appendable.quantity - the quantity to format.dest - the appendable destination.Appendable.IOException - if an I/O exception occurs.public final StringBuilder format(javax.measure.Quantity<?> q, StringBuilder dest)
#format(AbstractQuantity, Appendable) except it does not raise an IOException.quantity - the quantity to format.dest - the appendable destination.StringBuilder.public final String format(javax.measure.Quantity q)
format(unit, new StringBuilder()).toString();
obj - The object to formatIllegalArgumentException - if the Format cannot format the given objectCopyright © 2005–2016 Jean-Marie Dautelle, Werner Keil, V2COM. All rights reserved.