|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.text.Format
javax.measure.unit.UnitFormat
javax.measure.unit.UnitFormat.DefaultFormat
protected static class UnitFormat.DefaultFormat
This class represents the standard format.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.measure.unit.UnitFormat |
---|
UnitFormat.ASCIIFormat, UnitFormat.DefaultFormat |
Nested classes/interfaces inherited from class java.text.Format |
---|
java.text.Format.Field |
Constructor Summary | |
---|---|
protected |
UnitFormat.DefaultFormat()
|
Method Summary | |
---|---|
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)
|
Methods inherited from class javax.measure.unit.UnitFormat |
---|
format, getInstance, getInstance, getUCUMInstance, parseObject |
Methods inherited from class java.text.Format |
---|
clone, format, formatToCharacterIterator, parseObject |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected UnitFormat.DefaultFormat()
Method Detail |
---|
public void label(Unit<?> unit, java.lang.String label)
UnitFormat
label
in class UnitFormat
unit
- the unit being labelled.label
- the new label for this unit.public void alias(Unit<?> unit, java.lang.String alias)
UnitFormat
alias
in class UnitFormat
unit
- the unit being aliased.alias
- the alias attached to this unit.public boolean isValidIdentifier(java.lang.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 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
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.
java.text.ParseException
public Unit<? extends Quantity> parseProductUnit(java.lang.CharSequence csq, java.text.ParsePosition pos) throws java.text.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.
java.text.ParseException
public java.lang.Appendable format(Unit<?> unit, java.lang.Appendable appendable) throws java.io.IOException
UnitFormat
format
in class UnitFormat
unit
- the unit to format.appendable
- the appendable destination.
java.io.IOException
- if an error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |