Interface FormatService


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

    • 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:
      the default QuantityFormat implementation.
    • getQuantityFormat

      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 - the name of the format.
      Returns:
      the corresponding quantity format.
    • 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:
      the default UnitFormat implementation.
    • getUnitFormat

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

      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 - the name of the format.
      variant - any arbitrary value used to indicate a variation of a UnitFormat.
      Returns:
      the corresponding unit format.
    • getAvailableFormatNames

      Gets a list with available format names of a given type for this format service.
      Parameters:
      type - the FormatService.FormatType
      Returns:
      list of available formats, never null.