Enum UnitOfLength

    • Method Detail

      • values

        public static UnitOfLength[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (UnitOfLength c : UnitOfLength.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static UnitOfLength valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getTranslatedString

        public static String getTranslatedString​(UnitOfLength unitOfLength,
                                                 TranslationService ts)
        Provides internationalization support for each entry in the enumeration.
        Parameters:
        unitOfLength - The unit to be translated.
        ts - The translation service.
        Returns:
        The translated entry.
      • toMeters

        public static double toMeters​(Double length,
                                      UnitOfLength unitOfLength)
        Converts a given value of another unit to meters.
        Parameters:
        length - The length in a unit other that meters (though value in meters is also supported).
        unitOfLength - The unit to be converted to.
        Returns:
        The converted value.
      • convertMeters

        public static double convertMeters​(Double meters,
                                           UnitOfLength unitOfLength)
        Converts from meter to a unit of length.
        Parameters:
        meters - Length in meters.
        unitOfLength - The unit to convert the meters.
        Returns:
        Converted meters