Interface SystemOfUnitsService

    • Method Detail

      • getSystemOfUnits

        SystemOfUnits getSystemOfUnits​(java.lang.String name)
        Returns the system of units having the specified name or null if none is found.
        Parameters:
        name - the system of unit name.
        Returns:
        the system of units for the given name.
      • getPrefixes

        default <P extends Prefix> java.util.Set<P> getPrefixes​(java.lang.Class<P> prefixType)
        Returns a 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.
        Type Parameters:
        P - compile-time value of the prefixType argument
        Parameters:
        prefixType - the Prefix type
        Returns:
        a set containing the constant values of this Prefix type, in the order they're declared
        Throws:
        java.lang.ClassCastException - if the class is not compatible with the desired Prefix implementation or does not implement Prefix at all.
        Since:
        2.0