Serializable, Cloneable, javax.measure.format.QuantityFormat, tech.uom.lib.common.function.Parser<CharSequence,javax.measure.Quantity>NumberDelimiterQuantityFormat, SimpleQuantityFormatpublic abstract class AbstractQuantityFormat extends Format implements javax.measure.format.QuantityFormat, tech.uom.lib.common.function.Parser<CharSequence,javax.measure.Quantity>
This class provides the interface for formatting and parsing quantities.
Format.Field| Modifier and Type | Field | Description |
|---|---|---|
protected static String |
DEFAULT_DELIMITER |
The default delimiter.
|
| Constructor | Description |
|---|---|
AbstractQuantityFormat() |
| Modifier and Type | Method | Description |
|---|---|---|
StringBuffer |
format(Object obj,
StringBuffer toAppendTo,
FieldPosition pos) |
|
String |
format(javax.measure.Quantity<?> quantity) |
Formats an object to produce a string.
|
abstract Appendable |
format(javax.measure.Quantity<?> quantity,
Appendable dest) |
Formats the specified quantity into an
Appendable. |
protected StringBuffer |
format(ComparableQuantity<?> quantity,
StringBuffer dest) |
Convenience method equivalent to
#format(ComparableQuantity, Appendable) except it does not raise an IOException. |
protected abstract StringBuffer |
formatMixed(MixedQuantity<?> mixed,
StringBuffer dest) |
Convenience method equivalent to
#format(MixedQuantity, Appendable) except it does not raise an IOException. |
abstract javax.measure.Quantity<?> |
parse(CharSequence csq) |
Parses a portion of the specified
CharSequence from the specified position to produce an object. |
protected abstract javax.measure.Quantity<?> |
parse(CharSequence csq,
int index) |
Parses a portion of the specified
CharSequence from the specified position to produce an object. |
abstract javax.measure.Quantity<?> |
parse(CharSequence csq,
ParsePosition cursor) |
Parses a portion of the specified
CharSequence from the specified position to produce an object. |
javax.measure.Quantity<?> |
parseObject(String source,
ParsePosition pos) |
clone, format, formatToCharacterIterator, parseObjectprotected static final String DEFAULT_DELIMITER
public AbstractQuantityFormat()
public abstract Appendable format(javax.measure.Quantity<?> quantity, Appendable dest) throws IOException
Appendable.format in interface javax.measure.format.QuantityFormatquantity - the quantity to format.dest - the appendable destination.Appendable.IOException - if an I/O exception occurs.public abstract javax.measure.Quantity<?> parse(CharSequence csq, ParsePosition cursor) throws IllegalArgumentException, javax.measure.format.MeasurementParseException
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 javax.measure.format.QuantityFormatcsq - the CharSequence to parse.cursor - the cursor holding the current parsing index.IllegalArgumentException - if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).javax.measure.format.MeasurementParseExceptionpublic abstract javax.measure.Quantity<?> parse(CharSequence csq) throws javax.measure.format.MeasurementParseException
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 tech.uom.lib.common.function.Parser<CharSequence,javax.measure.Quantity>parse in interface javax.measure.format.QuantityFormatcsq - the CharSequence to parse.IllegalArgumentException - if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).javax.measure.format.MeasurementParseExceptionprotected abstract javax.measure.Quantity<?> parse(CharSequence csq, int index) throws IllegalArgumentException, javax.measure.format.MeasurementParseException
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.csq - the CharSequence to parse.index - the current parsing index.IllegalArgumentException - if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).javax.measure.format.MeasurementParseExceptionpublic final StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
public final javax.measure.Quantity<?> parseObject(String source, ParsePosition pos)
parseObject in class Formatpublic final String format(javax.measure.Quantity<?> quantity)
format(unit, new StringBuilder()).toString();
format in interface javax.measure.format.QuantityFormatquantity - The quantity to formatprotected final StringBuffer format(ComparableQuantity<?> quantity, StringBuffer dest)
#format(ComparableQuantity, Appendable) except it does not raise an IOException.quantity - the quantity to format.dest - the appendable destination.StringBuilder.protected abstract StringBuffer formatMixed(MixedQuantity<?> mixed, StringBuffer dest)
#format(MixedQuantity, Appendable) except it does not raise an IOException.mixed - the mixed quantity to format.dest - the appendable destination.StringBuilder.Copyright © 2005–2023 Units of Measurement project. All rights reserved.