- All Implemented Interfaces:
Serializable
,Comparable<CurrencyUtils>
,Constable
Helper utility class for currency operations.
- Author:
- Alex Bogdanovski [[email protected]]
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract String
formatPrice
(Double price, String cur) Formats a price for its specific locale, depending on the currency code.Returns a map of all available currencies in the form: currency code - full currency name and symbol.abstract Currency
getCurrency
(String cur) Returns the currency instance for a given currency code.abstract Currency
getCurrency
(Locale loc) Returns the currency instance for a given locale.abstract String
getCurrencyName
(String cur, Locale locale) Returns the full name of the currency in the language of the given locale.static CurrencyUtils
Returns an instance of this class.abstract Locale
getLocaleForCountry
(String countryCode) Returns the locale for a given country code.abstract boolean
isValidCurrency
(String cur) Validate the currency code.static CurrencyUtils
Returns the enum constant of this class with the specified name.static CurrencyUtils[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
INSTANCE
Singleton.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException
- if the argument is null
-
formatPrice
-
getCurrencyName
-
getLocaleForCountry
-
getCurrency
-
getCurrency
-
getCurrenciesMap
-
isValidCurrency
Validate the currency code.- Parameters:
cur
- a 3-letter curency code- Returns:
- true if the code corresponds to a valid currency
-
getInstance
-