public interface SystemOfUnitsService
system
of units
.
Common systems of units are "SI" (System International) or Metric system, "Imperial" (British), or "US" (US Customary).
Modifier and Type | Method | Description |
---|---|---|
Collection<SystemOfUnits> |
getAvailableSystemsOfUnits() |
Gets a list with available systems for this
SystemOfUnitsService . |
default <P extends Prefix> |
getPrefixes(Class<P> prefixType) |
|
SystemOfUnits |
getSystemOfUnits() |
Returns the default
system of units . |
SystemOfUnits |
getSystemOfUnits(String name) |
Returns the system of units having the specified name or
null if
none is found. |
SystemOfUnits getSystemOfUnits()
system of units
. Depending on the
implementation this may be the International
System of Units or another default system.SystemOfUnits getSystemOfUnits(String name)
null
if
none is found.name
- the system of unit name.Collection<SystemOfUnits> getAvailableSystemsOfUnits()
SystemOfUnitsService
.default <P extends Prefix> Set<P> getPrefixes(Class<P> prefixType)
Set
containing the values of a particular Prefix
type.
This method may be used to iterate over certain prefixes as follows:
for(MetricPrefix mp : service.getPrefixes(MetricPrefix.class))
System.out.println(p);
The default implementation assumes that prefixes of the given type are implemented as an enumeration.
This is the case of the two default prefix implementations provided in JSR 385,
namely MetricPrefix
and BinaryPrefix
.
Implementors shall override this method if they provide prefixes implemented in a different way.P
- compile-time value of the prefixType
argumentprefixType
- the Prefix
typeClassCastException
- if the class is not compatible with the desired
Prefix implementation or does not implement Prefix at all.Copyright © 2014–2019 Jean-Marie Dautelle, Werner Keil, Otavio Santana. All rights reserved.