javax.measure.unit
protected static class UnitFormat.DefaultFormat extends UnitFormat
UnitFormat.ASCIIFormat, UnitFormat.DefaultFormat| Modifier | Constructor and Description |
|---|---|
protected |
UnitFormat.DefaultFormat() |
| Modifier and Type | Method and Description |
|---|---|
void |
alias(Unit<?> unit,
java.lang.String alias)
Attaches a system-wide alias to this unit.
|
java.lang.Appendable |
format(Unit<?> unit,
java.lang.Appendable appendable)
Formats the specified unit.
|
boolean |
isValidIdentifier(java.lang.String name)
Indicates if the specified name can be used as unit identifier.
|
void |
label(Unit<?> unit,
java.lang.String label)
Attaches a system-wide label to the specified unit.
|
java.lang.String |
nameFor(Unit<?> unit) |
Unit<? extends Quantity> |
parseProductUnit(java.lang.CharSequence csq,
java.text.ParsePosition pos)
Parses a sequence of character to produce a unit or a rational product of unit.
|
Unit<? extends Quantity> |
parseSingleUnit(java.lang.CharSequence csq,
java.text.ParsePosition pos)
Parses a sequence of character to produce a single unit.
|
Unit<?> |
unitFor(java.lang.String name) |
format, getInstance, getInstance, getUCUMInstance, parseObjectpublic void label(Unit<?> unit, java.lang.String label)
UnitFormatlabel in class UnitFormatunit - the unit being labelled.label - the new label for this unit.public void alias(Unit<?> unit, java.lang.String alias)
UnitFormatalias in class UnitFormatunit - the unit being aliased.alias - the alias attached to this unit.public boolean isValidIdentifier(java.lang.String name)
UnitFormatisValidIdentifier in class UnitFormatname - the identifier to be tested.true if the name specified can be used as label or alias for this format;false
otherwise.public java.lang.String nameFor(Unit<?> unit)
public Unit<?> unitFor(java.lang.String name)
public Unit<? extends Quantity> parseSingleUnit(java.lang.CharSequence csq, java.text.ParsePosition pos) throws java.text.ParseException
UnitFormatparseSingleUnit in class UnitFormatcsq - the CharSequence to parse.pos - an object holding the parsing index and error position.Unit parsed from the character sequence.java.text.ParseExceptionpublic Unit<? extends Quantity> parseProductUnit(java.lang.CharSequence csq, java.text.ParsePosition pos) throws java.text.ParseException
UnitFormatparseProductUnit in class UnitFormatcsq - the CharSequence to parse.pos - an object holding the parsing index and error position.Unit parsed from the character sequence.java.text.ParseExceptionpublic java.lang.Appendable format(Unit<?> unit, java.lang.Appendable appendable) throws java.io.IOException
UnitFormatformat in class UnitFormatunit - the unit to format.appendable - the appendable destination.java.io.IOException - if an error occurs.