Enum UnitOfLength
- java.lang.Object
-
- java.lang.Enum<UnitOfLength>
-
- com.neotropic.kuwaiba.modules.commercial.ospman.api.UnitOfLength
-
- All Implemented Interfaces:
Serializable
,Comparable<UnitOfLength>
public enum UnitOfLength extends Enum<UnitOfLength>
Set of units of length supported- Author:
- Johny Andres Ortega Ruiz <johny.ortega@kuwaiba.org>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static double
convertMeters(Double meters, UnitOfLength unitOfLength)
Converts from meter to a unit of length.static String
getTranslatedString(UnitOfLength unitOfLength, TranslationService ts)
Provides internationalization support for each entry in the enumeration.static UnitOfLength
getUnitOfLength(String unitOfLength)
static List<UnitOfLength>
getUnits()
elemental.json.JsonObject
toJson(double numberOfDigits, TranslationService ts)
static double
toMeters(Double length, UnitOfLength unitOfLength)
Converts a given value of another unit to meters.String
toString()
static UnitOfLength
valueOf(String name)
Returns the enum constant of this type with the specified name.static UnitOfLength[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
M
public static final UnitOfLength M
-
KM
public static final UnitOfLength KM
-
IN
public static final UnitOfLength IN
-
FT
public static final UnitOfLength FT
-
YD
public static final UnitOfLength YD
-
MI
public static final UnitOfLength MI
-
-
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 nameNullPointerException
- if the argument is null
-
getUnitOfLength
public static UnitOfLength getUnitOfLength(String unitOfLength)
-
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
-
getUnits
public static List<UnitOfLength> getUnits()
-
toString
public String toString()
- Overrides:
toString
in classEnum<UnitOfLength>
-
toJson
public elemental.json.JsonObject toJson(double numberOfDigits, TranslationService ts)
-
-