public enum CurrencyUtils extends Enum<CurrencyUtils>
| Enum Constant and Description |
|---|
INSTANCE
Singleton.
|
| Modifier and Type | Method and Description |
|---|---|
abstract String |
formatPrice(Double price,
String cur)
Formats a price for its specific locale, depending on the currency code.
|
abstract Map<String,String> |
getCurrenciesMap()
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 String |
getCurrencyName(String cur,
Locale locale)
Returns the full name of the currency in the language of the given locale.
|
static CurrencyUtils |
getInstance()
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 |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static CurrencyUtils[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final CurrencyUtils INSTANCE
public static CurrencyUtils[] values()
for (CurrencyUtils c : CurrencyUtils.values()) System.out.println(c);
public static CurrencyUtils valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic abstract String formatPrice(Double price, String cur)
price - the amountcur - the 3-letter currency codepublic abstract String getCurrencyName(String cur, Locale locale)
cur - the 3-letter currency codelocale - the localepublic abstract Locale getLocaleForCountry(String countryCode)
countryCode - the 2-letter country codepublic abstract Currency getCurrency(String cur)
cur - the 3-letter currency codepublic abstract Map<String,String> getCurrenciesMap()
public abstract boolean isValidCurrency(String cur)
cur - a 3-letter curency codepublic static CurrencyUtils getInstance()
Copyright © 2018 Erudika. All rights reserved.