Class Country
- java.lang.Object
-
- com.opengamma.strata.basics.location.Country
-
- All Implemented Interfaces:
Serializable,Comparable<Country>
public final class Country extends Object implements Comparable<Country>, Serializable
A country or territory.This class represents a country or territory that it is useful to identify. Any two letter code may be used, however it is intended to use codes based on ISO-3166-1 alpha-2.
This class is immutable and thread-safe.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static CountryARThe country 'AR' - Argentina.static CountryATThe country 'AT' - Austria.static CountryAUThe country 'AU' - Australia.static CountryBEThe country 'BE' - Belgium.static CountryBRThe country 'BR' - Brazil.static CountryCAThe country 'CA' - Canada.static CountryCHThe country 'CH' - Switzerland.static CountryCLThe country 'CL' - Chile.static CountryCNThe country 'CN' - China.static CountryCZThe currency 'CZ' - Czech Republic.static CountryDEThe country 'DE' - Germany.static CountryDKThe country 'DK' - Denmark.static CountryEGThe currency 'EG' - Egypt.static CountryESThe currency 'ES' - Spain.static CountryEUThe region of 'EU' - Europe (special status in ISO-3166).static CountryFIThe currency 'FI' - Finland.static CountryFRThe currency 'FR' - France.static CountryGBThe country 'GB' - United Kingdom.static CountryGRThe country 'GR' - Greece.static CountryHKThe currency 'HK' - Hong Kong.static CountryHUThe currency 'HU' = Hungary.static CountryIDThe country 'ID' - Indonesia.static CountryIEThe currency 'IE' - Ireland.static CountryILThe country 'IL' - Israel.static CountryINThe country 'IN' - India.static CountryISThe currency 'IS' - Iceland.static CountryITThe currency 'IT' - Italy.static CountryJPThe country 'JP' - Japan.static CountryKRThe country 'KR' - South Korea.static CountryLUThe currency 'LU' - Luxembourg.static CountryMXThe country 'MX' - Mexico.static CountryMYThe country 'MY' - Malaysia.static CountryNLThe currency 'NL' - Netherlands.static CountryNOThe currency 'NO' - Norway.static CountryNZThe country 'NZ' - New Zealand.static CountryPLThe currency 'PL' = Poland.static CountryPTThe currency 'PT' - Portugal.static CountryRUThe currency 'RU' = Russia.static CountrySAThe country 'SA' - Saudi Arabia.static CountrySEThe currency 'SE' - Sweden.static CountrySGThe country 'SG' - Singapore.static CountrySKThe currency 'SK' - Slovakia.static CountryTHThe country 'TH' - Thailand.static CountryTRThe country 'TR' - Turkey.static CountryUSThe country 'US' - United States.static CountryZAThe country 'ZA' - South Africa.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Country other)Compares this country to another.booleanequals(Object obj)Checks if this country equals another country.static Set<Country>getAvailableCountries()Obtains the set of available countries.StringgetCode()Gets the two letter ISO code.StringgetCode3Char()Gets the ISO-3166-1 alpha-3 three letter country code.inthashCode()Returns a suitable hash code for the country.static Countryof(String countryCode)Obtains an instance from the specified ISO-3166-1 alpha-2 two letter country code dynamically creating a country if necessary.static Countryof3Char(String countryCode)Obtains an instance from the specified ISO-3166-1 alpha-3 three letter country code dynamically creating a country if necessary.static Countryparse(String countryCode)Parses a string to obtain aCountry.StringtoString()Returns a string representation of the country, which is the two letter code.
-
-
-
Field Detail
-
EU
public static final Country EU
The region of 'EU' - Europe (special status in ISO-3166).
-
AT
public static final Country AT
The country 'AT' - Austria.
-
BE
public static final Country BE
The country 'BE' - Belgium.
-
CH
public static final Country CH
The country 'CH' - Switzerland.
-
CZ
public static final Country CZ
The currency 'CZ' - Czech Republic.
-
DE
public static final Country DE
The country 'DE' - Germany.
-
DK
public static final Country DK
The country 'DK' - Denmark.
-
ES
public static final Country ES
The currency 'ES' - Spain.
-
FI
public static final Country FI
The currency 'FI' - Finland.
-
FR
public static final Country FR
The currency 'FR' - France.
-
GB
public static final Country GB
The country 'GB' - United Kingdom.
-
GR
public static final Country GR
The country 'GR' - Greece.
-
HU
public static final Country HU
The currency 'HU' = Hungary.
-
IE
public static final Country IE
The currency 'IE' - Ireland.
-
IS
public static final Country IS
The currency 'IS' - Iceland.
-
IT
public static final Country IT
The currency 'IT' - Italy.
-
LU
public static final Country LU
The currency 'LU' - Luxembourg.
-
NL
public static final Country NL
The currency 'NL' - Netherlands.
-
NO
public static final Country NO
The currency 'NO' - Norway.
-
PL
public static final Country PL
The currency 'PL' = Poland.
-
PT
public static final Country PT
The currency 'PT' - Portugal.
-
SE
public static final Country SE
The currency 'SE' - Sweden.
-
SK
public static final Country SK
The currency 'SK' - Slovakia.
-
TR
public static final Country TR
The country 'TR' - Turkey.
-
AR
public static final Country AR
The country 'AR' - Argentina.
-
BR
public static final Country BR
The country 'BR' - Brazil.
-
CA
public static final Country CA
The country 'CA' - Canada.
-
CL
public static final Country CL
The country 'CL' - Chile.
-
MX
public static final Country MX
The country 'MX' - Mexico.
-
US
public static final Country US
The country 'US' - United States.
-
AU
public static final Country AU
The country 'AU' - Australia.
-
CN
public static final Country CN
The country 'CN' - China.
-
EG
public static final Country EG
The currency 'EG' - Egypt.
-
HK
public static final Country HK
The currency 'HK' - Hong Kong.
-
ID
public static final Country ID
The country 'ID' - Indonesia.
-
IL
public static final Country IL
The country 'IL' - Israel.
-
IN
public static final Country IN
The country 'IN' - India.
-
JP
public static final Country JP
The country 'JP' - Japan.
-
KR
public static final Country KR
The country 'KR' - South Korea.
-
MY
public static final Country MY
The country 'MY' - Malaysia.
-
NZ
public static final Country NZ
The country 'NZ' - New Zealand.
-
RU
public static final Country RU
The currency 'RU' = Russia.
-
SA
public static final Country SA
The country 'SA' - Saudi Arabia.
-
SG
public static final Country SG
The country 'SG' - Singapore.
-
TH
public static final Country TH
The country 'TH' - Thailand.
-
ZA
public static final Country ZA
The country 'ZA' - South Africa.
-
-
Method Detail
-
getAvailableCountries
public static Set<Country> getAvailableCountries()
Obtains the set of available countries.This contains all the countries that have been defined at the point that the method is called.
- Returns:
- an immutable set containing all registered countries
-
of
public static Country of(String countryCode)
Obtains an instance from the specified ISO-3166-1 alpha-2 two letter country code dynamically creating a country if necessary.A country is uniquely identified by ISO-3166-1 alpha-2 two letter code. This method creates the country if it is not known.
- Parameters:
countryCode- the two letter country code, ASCII and upper case- Returns:
- the singleton instance
- Throws:
IllegalArgumentException- if the country code is invalid
-
parse
public static Country parse(String countryCode)
Parses a string to obtain aCountry.The parse is identical to
of(String)except that it will convert letters to upper case first.- Parameters:
countryCode- the two letter country code, ASCII- Returns:
- the singleton instance
- Throws:
IllegalArgumentException- if the country code is invalid
-
of3Char
public static Country of3Char(String countryCode)
Obtains an instance from the specified ISO-3166-1 alpha-3 three letter country code dynamically creating a country if necessary.A country is uniquely identified by ISO-3166-1 alpha-3 three letter code. This method creates the country if it is not known.
- Parameters:
countryCode- the three letter country code, ASCII and upper case- Returns:
- the singleton instance
- Throws:
IllegalArgumentException- if the country code is invalid
-
getCode
public String getCode()
Gets the two letter ISO code.- Returns:
- the two letter ISO code
-
getCode3Char
public String getCode3Char()
Gets the ISO-3166-1 alpha-3 three letter country code.- Returns:
- the three letter country code
- Throws:
IllegalArgumentException- if the country is invalid
-
compareTo
public int compareTo(Country other)
Compares this country to another.The comparison sorts alphabetically by the two letter country code.
- Specified by:
compareToin interfaceComparable<Country>- Parameters:
other- the other country- Returns:
- negative if less, zero if equal, positive if greater
-
equals
public boolean equals(Object obj)
Checks if this country equals another country.The comparison checks the two letter country code.
-
hashCode
public int hashCode()
Returns a suitable hash code for the country.
-
-