Serializable, Cloneablepublic class NumberDelimiterQuantityFormat extends AbstractQuantityFormat
| Modifier and Type | Class | Description |
|---|---|---|
static class |
NumberDelimiterQuantityFormat.Builder |
A fluent Builder to easily create new instances of
NumberDelimiterQuantityFormat. |
Format.FieldDEFAULT_DELIMITER| Modifier and Type | Method | Description |
|---|---|---|
static NumberDelimiterQuantityFormat.Builder |
builder() |
Returns a new instance of
NumberDelimiterQuantityFormat.Builder. |
Appendable |
format(javax.measure.Quantity<?> quantity,
Appendable dest) |
Formats the specified quantity into an
Appendable. |
protected StringBuffer |
formatMixed(MixedQuantity<?> comp,
StringBuffer dest) |
Convenience method equivalent to
#format(MixedQuantity, Appendable) except it does not raise an IOException. |
static NumberDelimiterQuantityFormat |
getInstance() |
Returns the default format.
|
static NumberDelimiterQuantityFormat |
getInstance(NumberFormat numberFormat,
javax.measure.format.UnitFormat unitFormat) |
Returns the quantity format using the specified number format and unit format (the number and unit are separated by one space).
|
static NumberDelimiterQuantityFormat |
getInstance(FormatBehavior behavior) |
Returns an instance of
NumberDelimiterQuantityFormat with a particular FormatBehavior, either locale-sensitive or locale-neutral. |
boolean |
isLocaleSensitive() |
|
javax.measure.Quantity<?> |
parse(CharSequence csq) |
Parses a portion of the specified
CharSequence from the specified position to produce an object. |
protected javax.measure.Quantity<?> |
parse(CharSequence csq,
int index) |
Parses a portion of the specified
CharSequence from the specified position to produce an object. |
javax.measure.Quantity<?> |
parse(CharSequence csq,
ParsePosition cursor) |
Parses a portion of the specified
CharSequence from the specified position to produce an object. |
MixedQuantity<?> |
parseMixed(CharSequence csq) |
|
protected MixedQuantity<?> |
parseMixed(CharSequence csq,
int index) |
|
MixedQuantity<?> |
parseMixed(CharSequence csq,
ParsePosition cursor) |
|
String |
toString() |
format, format, format, parseObjectclone, format, formatToCharacterIterator, parseObjectpublic static NumberDelimiterQuantityFormat getInstance(FormatBehavior behavior)
NumberDelimiterQuantityFormat with a particular FormatBehavior, either locale-sensitive or locale-neutral.
For example: NumberDelimiterQuantityFormat.getInstance(LOCALE_NEUTRAL)) returnsnew NumberDelimiterQuantityFormat.Builder()
.setNumberFormat(NumberFormat.getInstance(Locale.ROOT)).setUnitFormat(SimpleUnitFormat.getInstance()).build();behavior - the format behavior to apply.NumberDelimiterQuantityFormat.getInstance(NumberFormat.getInstance(), UnitFormat.getInstance())public static final NumberDelimiterQuantityFormat.Builder builder()
NumberDelimiterQuantityFormat.Builder.NumberDelimiterQuantityFormat.Builder.public static NumberDelimiterQuantityFormat getInstance()
public static NumberDelimiterQuantityFormat getInstance(NumberFormat numberFormat, javax.measure.format.UnitFormat unitFormat)
numberFormat - the number format.unitFormat - the unit format.public Appendable format(javax.measure.Quantity<?> quantity, Appendable dest) throws IOException
AbstractQuantityFormatAppendable.format in class AbstractQuantityFormatquantity - the quantity to format.dest - the appendable destination.Appendable.IOException - if an I/O exception occurs.public javax.measure.Quantity<?> parse(CharSequence csq, ParsePosition cursor) throws IllegalArgumentException, javax.measure.format.MeasurementParseException
AbstractQuantityFormatCharSequence 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 AbstractQuantityFormatcsq - 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.MeasurementParseExceptionprotected javax.measure.Quantity<?> parse(CharSequence csq, int index) throws IllegalArgumentException, javax.measure.format.MeasurementParseException
AbstractQuantityFormatCharSequence 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 AbstractQuantityFormatcsq - 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 javax.measure.Quantity<?> parse(CharSequence csq) throws IllegalArgumentException, javax.measure.format.MeasurementParseException
AbstractQuantityFormatCharSequence 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 AbstractQuantityFormatcsq - the CharSequence to parse.IllegalArgumentException - if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).javax.measure.format.MeasurementParseExceptionpublic boolean isLocaleSensitive()
protected StringBuffer formatMixed(MixedQuantity<?> comp, StringBuffer dest)
AbstractQuantityFormat#format(MixedQuantity, Appendable) except it does not raise an IOException.formatMixed in class AbstractQuantityFormatcomp - the mixed quantity to format.dest - the appendable destination.StringBuilder.public MixedQuantity<?> parseMixed(CharSequence csq, ParsePosition cursor) throws IllegalArgumentException, javax.measure.format.MeasurementParseException
IllegalArgumentExceptionjavax.measure.format.MeasurementParseExceptionprotected MixedQuantity<?> parseMixed(CharSequence csq, int index) throws IllegalArgumentException, javax.measure.format.MeasurementParseException
IllegalArgumentExceptionjavax.measure.format.MeasurementParseExceptionpublic MixedQuantity<?> parseMixed(CharSequence csq) throws IllegalArgumentException, javax.measure.format.MeasurementParseException
IllegalArgumentExceptionjavax.measure.format.MeasurementParseExceptionCopyright © 2005–2023 Units of Measurement project. All rights reserved.