Top Description Inners Methods
javax.measure.spi

public Interface FormatService

Imports
java.util.Set, javax.measure.format.QuantityFormat, .UnitFormat

This interface represents the service to obtain instances of UnitFormat and QuantityFormat.
Author
Werner Keil
Since
2.0
Version
2.3, May 20, 2023

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
FormatService.FormatType

The type of format, either a UnitFormat or QuantityFormat

Method Summary

Modifier and TypeMethod and Description
public Set<String>

Returns:

list of available formats, never null.
getAvailableFormatNames
(FormatService.FormatType type)

Gets a list with available format names of a given type for this format service.

public QuantityFormat

Returns:

the default QuantityFormat implementation.
getQuantityFormat
()

Returns the default quantity format.

public QuantityFormat

Returns:

the corresponding quantity format.
getQuantityFormat
(String
the name of the format.
name
)

Returns the quantity format having the specified name or null if none.

public UnitFormat

Returns:

the default UnitFormat implementation.
getUnitFormat
()

Returns the default unit format.

public UnitFormat

Returns:

the corresponding unit format.
getUnitFormat
(String
the name of the format.
name
)

Returns the unit format having the specified name or null if none.

public UnitFormat

Returns:

the corresponding unit format.
getUnitFormat
(String
the name of the format.
name
,
String
any arbitrary value used to indicate a variation of a UnitFormat.
variant
)

Returns the unit format having the specified name or null if none.

Method Detail

getAvailableFormatNamesback to summary
public Set<String> getAvailableFormatNames(FormatService.FormatType type)

Gets a list with available format names of a given type for this format service.

Parameters
type:FormatService.FormatType

the FormatType

Returns:Set<String>

list of available formats, never null.

getQuantityFormatback to summary
public QuantityFormat getQuantityFormat()

Returns the default quantity format. It is up to implementations what to consider a suitable default. For some (locale-sensitive) implementations it may be a quantity format based on Locale.current() while others may return getQuantityFormat("Simple") or getQuantityFormat("ISO").

Returns:QuantityFormat

the default QuantityFormat implementation.

getQuantityFormatback to summary
public QuantityFormat getQuantityFormat(String name)

Returns the quantity format having the specified name or null if none. For example (@code getQuantityFormat("Simple")} to return the simple QuantityFormat implementation.

Parameters
name:String

the name of the format.

Returns:QuantityFormat

the corresponding quantity format.

getUnitFormatback to summary
public UnitFormat getUnitFormat()

Returns the default unit format. It is up to implementations what to consider a suitable default. For some (locale-sensitive) implementations it may be a unit format based on Locale.current() while others may return getUnitFormat("Simple") or getUnitFormat("ISO").

Returns:UnitFormat

the default UnitFormat implementation.

getUnitFormatback to summary
public UnitFormat getUnitFormat(String name)

Returns the unit format having the specified name or null if none. For example getUnitFormat("Simple") to return a simple UnitFormat implementation.

Parameters
name:String

the name of the format.

Returns:UnitFormat

the corresponding unit format.

getUnitFormatback to summary
public UnitFormat getUnitFormat(String name, String variant)

Returns the unit format having the specified name or null if none. For example getUnitFormat("Simple") to return a simple UnitFormat implementation.
The variant is an arbitrary value to allow a variation of a UnitFormat, for example UTF vs. ASCII encoding of the simple UnitFormat or case sensitive vs. case insensitive UCUM format.

If no variant is applicable, the UnitFormat matching the name only is returned.

Parameters
name:String

the name of the format.

variant:String

any arbitrary value used to indicate a variation of a UnitFormat.

Returns:UnitFormat

the corresponding unit format.

javax.measure.spi back to summary

public final Enum FormatService.FormatType

extends Enum<FormatService.FormatType>
Class Inheritance

The type of format, either a UnitFormat or QuantityFormat

Field Summary

Modifier and TypeField and Description
public static final FormatService.FormatType
public static final FormatService.FormatType
UNIT_FORMAT

Format of type UnitFormat

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static FormatService.FormatType
public static FormatService.FormatType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

QUANTITY_FORMATback to summary
public static final FormatService.FormatType QUANTITY_FORMAT

Format of type QuantityFormat

UNIT_FORMATback to summary
public static final FormatService.FormatType UNIT_FORMAT

Format of type UnitFormat

Constructor Detail

FormatTypeback to summary
private FormatType()

Method Detail

valueOfback to summary
public static FormatService.FormatType valueOf(String name)
valuesback to summary
public static FormatService.FormatType[] values()