Package tech.units.indriya.format
Class SimpleUnitFormat.ASCIIFormat
- java.lang.Object
-
- tech.units.indriya.format.AbstractUnitFormat
-
- tech.units.indriya.format.SimpleUnitFormat
-
- tech.units.indriya.format.SimpleUnitFormat.DefaultFormat
-
- tech.units.indriya.format.SimpleUnitFormat.ASCIIFormat
-
- All Implemented Interfaces:
javax.measure.format.UnitFormat
- Enclosing class:
- SimpleUnitFormat
protected static final class SimpleUnitFormat.ASCIIFormat extends SimpleUnitFormat.DefaultFormat
This class represents the ASCII format.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class tech.units.indriya.format.SimpleUnitFormat
SimpleUnitFormat.ASCIIFormat, SimpleUnitFormat.DefaultFormat, SimpleUnitFormat.Flavor
-
-
Field Summary
-
Fields inherited from class tech.units.indriya.format.SimpleUnitFormat.DefaultFormat
nameToUnit, unitToName
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ASCIIFormat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Appendable
format(javax.measure.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.protected java.lang.String
nameFor(javax.measure.Unit<?> unit)
protected javax.measure.Unit<?>
unitFor(java.lang.String name)
-
Methods inherited from class tech.units.indriya.format.SimpleUnitFormat.DefaultFormat
alias, getSymbols, isLocaleSensitive, isUnitIdentifierPart, label, parse, parse, parse, parseProductUnit, parseSingleUnit, prefixFor
-
Methods inherited from class tech.units.indriya.format.SimpleUnitFormat
format, getInstance, getInstance, isAllASCII, parseObject
-
Methods inherited from class tech.units.indriya.format.AbstractUnitFormat
format, format
-
-
-
-
Method Detail
-
nameFor
protected java.lang.String nameFor(javax.measure.Unit<?> unit)
- Overrides:
nameFor
in classSimpleUnitFormat.DefaultFormat
-
unitFor
protected javax.measure.Unit<?> unitFor(java.lang.String name)
- Overrides:
unitFor
in classSimpleUnitFormat.DefaultFormat
-
format
public java.lang.Appendable format(javax.measure.Unit<?> unit, java.lang.Appendable appendable) throws java.io.IOException
Description copied from class:SimpleUnitFormat
Formats the specified unit.- Specified by:
format
in interfacejavax.measure.format.UnitFormat
- Overrides:
format
in classSimpleUnitFormat.DefaultFormat
- Parameters:
unit
- the unit to format.appendable
- the appendable destination.- Returns:
- The appendable destination passed in as
appendable
, with formatted text appended. - Throws:
java.io.IOException
- if an error occurs.
-
isValidIdentifier
public boolean isValidIdentifier(java.lang.String name)
Description copied from class:SimpleUnitFormat
Indicates if the specified name can be used as unit identifier.- Overrides:
isValidIdentifier
in classSimpleUnitFormat.DefaultFormat
- Parameters:
name
- the identifier to be tested.- Returns:
true
if the name specified can be used as label or alias for this format;false
otherwise.
-
-