@Status(stage=PRODUCTION, unitTests=COMPLETE) @Review(by="Kees Schotanus", at="2012-02-06") public enum ZipCodeOfCountry extends Enum<ZipCodeOfCountry>
Masks
so zip codes can be formatted properly. For some countries a single mask is not enough. In this case
multiple masks may be used concatenated with the pipe (|) symbol.Enum Constant and Description |
---|
AFGHANISTAN
Afghanistan has 4 digits.
|
ALBANIA
Albania has 4 digits.
|
ALGERIA
Algeria has 5 digits.
|
ARGENTINA
Argentina has (letter)(4 digits)(2 letters).
|
AUSTRALIA
Australia has 4 digits.
|
AUSTRIA
Austria has 4 digits.
|
BELGIUM
Belgium has 4 digits.
|
BRAZIL
Brazil has 8 digits.
|
CANADA
Canada has (letter)(digit)(letter)(space)(digit)(letter)(digit).
|
CHINA
China has 6 digits.
|
FRANCE
France has 5 digits.
|
GERMANY
Germany has 5 digits.
|
GREECE
Greece has 5 digits.
|
HUNGARY
Hungary has 4 digits.
|
ICELAND
Iceland has 3 digits.
|
INDONESIA
Indonesia has 5 digits.
|
ISRAEL
Israel has 7 digits.
|
ITALY
Italy has 5 digits.
|
LUXEMBOURG
Luxembourg has 4 digits.
|
NETHERLANDS
Netherlands has 4 digits and 2 letters.
|
POLAND
Poland has 5 digits.
|
PORTUGAL
Portugal has 7 digits.
|
SPAIN
Spain has 5 digits.
|
SWEDEN
Sweden has 5 digits.
|
SWITZERLAND
Switzerland has 4 digits.
|
UNITED_KINGDOM
United Kingdom has: (1 or 2 letters)(1 or 2 digits)(optional letter)(space)(1 digit)(2 letters).
|
UNKNOWN_ZIP_CODE_OF_COUNTRY
Country with unknown zip code has 9 characters.
|
Modifier and Type | Method and Description |
---|---|
String |
fromMaskedValue(String zipCode)
Removes mask characters from the supplied zipCode.
|
String |
fromUnmaskedValue(String zipCode)
Adds mask characters to the supplied zipCode.
|
Iso3166Country |
getCountry()
Gets the country where this zip code is used.
|
String |
getMask()
Gets the mask to display a zip code.
|
int |
getMaximumMaskLength()
Gets the length of the longest mask.
|
Pattern |
getPattern()
Gets the pattern to verify a zip code against.
|
boolean |
isValidZipCode(String zipCode)
Determines whether the supplied zipCode is valid with respect to this
ZipCode.
|
static ZipCodeOfCountry |
valueOf(Iso3166Country country)
Gets the ZipCodeOfCountry corresponding to the supplied country.
|
static ZipCodeOfCountry |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ZipCodeOfCountry[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ZipCodeOfCountry AFGHANISTAN
public static final ZipCodeOfCountry ALBANIA
public static final ZipCodeOfCountry ALGERIA
public static final ZipCodeOfCountry ARGENTINA
public static final ZipCodeOfCountry AUSTRALIA
public static final ZipCodeOfCountry AUSTRIA
public static final ZipCodeOfCountry BELGIUM
public static final ZipCodeOfCountry BRAZIL
public static final ZipCodeOfCountry CANADA
public static final ZipCodeOfCountry CHINA
public static final ZipCodeOfCountry FRANCE
public static final ZipCodeOfCountry GERMANY
public static final ZipCodeOfCountry GREECE
public static final ZipCodeOfCountry HUNGARY
public static final ZipCodeOfCountry ICELAND
public static final ZipCodeOfCountry INDONESIA
public static final ZipCodeOfCountry ISRAEL
public static final ZipCodeOfCountry ITALY
public static final ZipCodeOfCountry LUXEMBOURG
public static final ZipCodeOfCountry NETHERLANDS
public static final ZipCodeOfCountry POLAND
public static final ZipCodeOfCountry PORTUGAL
public static final ZipCodeOfCountry SPAIN
public static final ZipCodeOfCountry SWEDEN
public static final ZipCodeOfCountry SWITZERLAND
public static final ZipCodeOfCountry UNITED_KINGDOM
public static final ZipCodeOfCountry UNKNOWN_ZIP_CODE_OF_COUNTRY
public static ZipCodeOfCountry[] values()
for (ZipCodeOfCountry c : ZipCodeOfCountry.values()) System.out.println(c);
public static ZipCodeOfCountry 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 Iso3166Country getCountry()
public Pattern getPattern()
public String getMask()
public int getMaximumMaskLength()
public boolean isValidZipCode(String zipCode)
zipCode
- The zipCode to validate.public static ZipCodeOfCountry valueOf(Iso3166Country country)
country
- The country.UNKNOWN_ZIP_CODE_OF_COUNTRY
is returned, supporting up to 9 characters.NullPointerException
- When the supplied country is null.public String fromUnmaskedValue(String zipCode)
zipCode
- The zip code to add the mask characters to.Copyright © 2008–2018. All rights reserved.