public enum CountryCode extends Enum<CountryCode>
Enum names of this enum themselves are represented by ISO 3166-1 alpha-2 codes. There
are instance methods to get the country name (getName()
), the ISO 3166-1
alpha-3 code (getAlpha3()
) and the ISO 3166-1 numeric code (
getNumeric()
). In addition, there are static methods to get a CountryCode instance that corresponds to a given alpha-2/alpha-3/numeric
code (getByCode(String)
, getByCode(int)
).
// EXAMPLE CountryCode cc = CountryCode.getByCode
("JP"); // Country name System.out.println("Country name = " + cc.getName()
); // "Japan" // ISO 3166-1 alpha-2 code System.out.println("ISO 3166-1 alpha-2 code = " + cc.getAlpha2()
); // "JP" // ISO 3166-1 alpha-3 code System.out.println("ISO 3166-1 alpha-3 code = " + cc.getAlpha3()
); // "JPN" // ISO 3166-1 numeric code System.out.println("ISO 3166-1 numeric code = " + cc.getNumeric()
); // 392
Enum Constant and Description |
---|
AU
|
CA
|
CH
|
CZ
|
DE
|
DK
|
EE
|
ES
|
FI
|
FR
|
GB
|
GR
|
HU
|
IE
|
IN
|
IS
|
IT
|
JP
|
NL
|
NO
|
NZ
|
PL
|
RO
|
RU
|
SE
|
TH
|
US
|
Modifier and Type | Method and Description |
---|---|
String |
getAlpha2()
Get the ISO 3166-1 alpha-2 code.
|
String |
getAlpha3()
Get the ISO 3166-1 alpha-3 code.
|
static CountryCode |
getByCode(int code)
Get a CountryCode that corresponds to a given ISO 3166-1 numeric code.
|
static CountryCode |
getByCode(String code)
|
String |
getName()
Get the country name.
|
int |
getNumeric()
Get the ISO 3166-1 numeric code.
|
String |
toString() |
static CountryCode |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static CountryCode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final CountryCode AU
public static final CountryCode CA
public static final CountryCode CH
public static final CountryCode CZ
public static final CountryCode DE
public static final CountryCode DK
public static final CountryCode EE
public static final CountryCode ES
public static final CountryCode FI
public static final CountryCode FR
public static final CountryCode GB
public static final CountryCode GR
public static final CountryCode HU
public static final CountryCode IE
public static final CountryCode IN
public static final CountryCode IS
public static final CountryCode IT
public static final CountryCode JP
public static final CountryCode NL
public static final CountryCode NO
public static final CountryCode NZ
public static final CountryCode PL
public static final CountryCode RO
public static final CountryCode RU
public static final CountryCode SE
public static final CountryCode TH
public static final CountryCode US
public static CountryCode[] values()
for (CountryCode c : CountryCode.values()) System.out.println(c);
public static CountryCode 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 String getName()
public String getAlpha2()
public String getAlpha3()
public int getNumeric()
public static CountryCode getByCode(String code)
public static CountryCode getByCode(int code)
code
- An ISO 3166-1 numeric code.public String toString()
toString
in class Enum<CountryCode>
Copyright © 2012–2015 tinyMediaManager. All rights reserved.