Class DefaultUnitsApiService

java.lang.Object
com.raynigon.unit.api.core.service.DefaultUnitsApiService
All Implemented Interfaces:
UnitsApiService, javax.measure.spi.SystemOfUnitsService

public class DefaultUnitsApiService extends Object implements UnitsApiService
  • Constructor Details

    • DefaultUnitsApiService

      public DefaultUnitsApiService()
    • DefaultUnitsApiService

      protected DefaultUnitsApiService(Set<javax.measure.spi.SystemOfUnits> systems)
  • Method Details

    • getInstance

      public static UnitsApiService getInstance()
    • replaceInstance

      public static UnitsApiService replaceInstance(UnitsApiService other)
    • getSystemOfUnits

      public javax.measure.spi.SystemOfUnits getSystemOfUnits()
      Specified by:
      getSystemOfUnits in interface javax.measure.spi.SystemOfUnitsService
    • getSystemOfUnits

      public javax.measure.spi.SystemOfUnits getSystemOfUnits(String name)
      Specified by:
      getSystemOfUnits in interface javax.measure.spi.SystemOfUnitsService
    • getAvailableSystemsOfUnits

      public Collection<javax.measure.spi.SystemOfUnits> getAvailableSystemsOfUnits()
      Specified by:
      getAvailableSystemsOfUnits in interface javax.measure.spi.SystemOfUnitsService
    • addSystemOfUnits

      public void addSystemOfUnits(javax.measure.spi.SystemOfUnits system)
      Description copied from interface: UnitsApiService
      Adds an additional SystemOfUnits to the UnitsApiService. The Name provided by the SystemOfUnits is used as an id and therefore has to be unique.
      Specified by:
      addSystemOfUnits in interface UnitsApiService
      Parameters:
      system - the additional SystemOfUnits
    • getUnit

      @NotNull public <T extends javax.measure.Quantity<T>> @NotNull javax.measure.Unit<T> getUnit(@NotNull @NotNull Class<T> quantityType)
      Specified by:
      getUnit in interface UnitsApiService
    • getUnit

      @NotNull public @NotNull javax.measure.Unit<?> getUnit(@NotNull @NotNull String symbol)
      Specified by:
      getUnit in interface UnitsApiService
    • format

      @NotNull public @NotNull String format(javax.measure.Quantity<?> quantity)
      Specified by:
      format in interface UnitsApiService
    • parseQuantity

      @NotNull public @NotNull javax.measure.Quantity<?> parseQuantity(@NotNull @NotNull String quantity)
      Specified by:
      parseQuantity in interface UnitsApiService
    • createQuantity

      public <Q extends javax.measure.Quantity<Q>> javax.measure.Quantity<Q> createQuantity(@NotNull @NotNull Number value, @NotNull @NotNull javax.measure.Unit<Q> unit)
      Specified by:
      createQuantity in interface UnitsApiService