protected static class UnitFormat.DefaultFormat extends UnitFormat
UnitFormat.ASCIIFormat, UnitFormat.DefaultFormat
Format.Field
Modifier | Constructor and Description |
---|---|
protected |
UnitFormat.DefaultFormat() |
Modifier and Type | Method and Description |
---|---|
void |
alias(Unit<?> unit,
String alias)
Attaches a system-wide alias to this unit.
|
Appendable |
format(Unit<?> unit,
Appendable appendable)
Formats the specified unit.
|
boolean |
isValidIdentifier(String name)
Indicates if the specified name can be used as unit identifier.
|
void |
label(Unit<?> unit,
String label)
Attaches a system-wide label to the specified unit.
|
String |
nameFor(Unit<?> unit) |
Unit<? extends Quantity> |
parseProductUnit(CharSequence csq,
ParsePosition pos)
Parses a sequence of character to produce a unit or a rational product
of unit.
|
Unit<? extends Quantity> |
parseSingleUnit(CharSequence csq,
ParsePosition pos)
Parses a sequence of character to produce a single unit.
|
Unit<?> |
unitFor(String name) |
format, getInstance, getInstance, getUCUMInstance, parseObject
clone, format, formatToCharacterIterator, parseObject
public void label(Unit<?> unit, String label)
UnitFormat
label
in class UnitFormat
unit
- the unit being labelled.label
- the new label for this unit.public void alias(Unit<?> unit, String alias)
UnitFormat
alias
in class UnitFormat
unit
- the unit being aliased.alias
- the alias attached to this unit.public boolean isValidIdentifier(String name)
UnitFormat
isValidIdentifier
in class UnitFormat
name
- the identifier to be tested.true
if the name specified can be used as
label or alias for this format;false
otherwise.public Unit<? extends Quantity> parseSingleUnit(CharSequence csq, ParsePosition pos) throws ParseException
UnitFormat
parseSingleUnit
in class UnitFormat
csq
- the CharSequence
to parse.pos
- an object holding the parsing index and error position.Unit
parsed from the character sequence.ParseException
public Unit<? extends Quantity> parseProductUnit(CharSequence csq, ParsePosition pos) throws ParseException
UnitFormat
parseProductUnit
in class UnitFormat
csq
- the CharSequence
to parse.pos
- an object holding the parsing index and error position.Unit
parsed from the character sequence.ParseException
public Appendable format(Unit<?> unit, Appendable appendable) throws IOException
UnitFormat
format
in class UnitFormat
unit
- the unit to format.appendable
- the appendable destination.IOException
- if an error occurs.Copyright © 2012. All Rights Reserved.