com.gisgraphy.domain.geoloc.entity
Class Country

java.lang.Object
  extended by com.gisgraphy.domain.geoloc.entity.GisFeature
      extended by com.gisgraphy.domain.geoloc.entity.Country
All Implemented Interfaces:
Serializable, Comparable<Country>

public class Country
extends GisFeature
implements Serializable, Comparable<Country>

A Country (as defined by ISO 3166). A country always has an ISO 3166 alpha-2, alpha-3 and numeric code, but may, or may not have other names (FIPS, etc). The list of countries has been imported from Geonames Country List. Codes are written in upper case !

Author:
David Masclet
See Also:
Country Name Codes, Serialized Form

Field Summary
 
Fields inherited from class com.gisgraphy.domain.geoloc.entity.GisFeature
LOCATION_COLUMN_NAME, logger
 
Constructor Summary
Country()
          Default constructor (Needed by CGLib)
Country(GisFeature gisFeature)
          Constructor that populate the Country with the gisFeature fields
Country(String iso3166Alpha2Code, String iso3166Alpha3Code, int iso3166NumericCode)
          Construct a country with the iso 3166 alpha-2 code, iso 3166 alpha-3 code, and iso 3166 numeric code
 
Method Summary
 void addSpokenLanguage(Language lang)
          Add a spoken language to the country.
 void addSpokenLanguages(List<Language> languages)
           
 int compareTo(Country country)
          compare the name of the country
 boolean equals(Object obj)
           
 Double getArea()
          Country area in square Km
 String getCapitalName()
          Get the capital for this country
 String getContinent()
          Returns The name of the continent this country belongs to
 Currency getCurrency()
          Returns the ISO 4217 Currency from the currency code.
 String getCurrencyCode()
          ISO 4217 currency code when possible.
 String getCurrencyName()
          Returns The name of the currency for this country.
 String getEquivalentFipsCode()
          This field is not supported yet.
 String getFipsCode()
          The FIPS 10.4 country code.
 String getIso3166Alpha2Code()
          The ISO 3166 alpha-2 letter code(should be in upper case).
 String getIso3166Alpha3Code()
          The ISO 3166 alpha-3 letter code (should be in upper case)
 int getIso3166NumericCode()
           
 String getPhonePrefix()
          The Phone Prefix (e.g : 33..) without '+'
 String getPostalCodeMask()
           
 String getPostalCodeRegex()
          Returns The regexp that every Zipcode for this country matches. it is useful to test if a zipcode is valid. this field is imported from file and is not tested.
 List<Language> getSpokenLanguages()
          All language spoken in this Country.
 String getTld()
          Returns the top level domain for this country with the starting point.
 int hashCode()
           
 void setArea(Double area)
           
 void setCapitalName(String capitalName)
           
 void setContinent(String continent)
           
 void setCurrencyCode(String currencyCode)
          Set the currency code for this country
 void setCurrencyName(String currencyName)
           
 void setEquivalentFipsCode(String equivalentFipsCode)
           
 void setFipsCode(String fipsCode)
           
 void setIso3166Alpha2Code(String isoCode)
          Set the iso3166 alpha-2 code.
 void setIso3166Alpha3Code(String iso3166Alpha3Code)
          Note : The code will be automaticaly uppercased
 void setIso3166NumericCode(int iso3166NumericCode)
           
 void setPhonePrefix(String phonePrefix)
           
 void setPostalCodeMask(String postalCodeMask)
           
 void setPostalCodeRegex(String postalCodeRegex)
           
 void setSpokenLanguages(List<Language> languages)
           
 void setTld(String tld)
           
 
Methods inherited from class com.gisgraphy.domain.geoloc.entity.GisFeature
addAlternateName, addAlternateNames, addZipCode, addZipCodes, distanceTo, getAdm, getAdm1Code, getAdm1Name, getAdm2Code, getAdm2Name, getAdm3Code, getAdm3Name, getAdm4Code, getAdm4Name, getAlternateNames, getAsciiName, getCountry, getCountryCode, getElevation, getFeatureClass, getFeatureCode, getFeatureId, getFullyQualifiedName, getFullyQualifiedName, getGtopo30, getId, getLatitude, getLocation, getLongitude, getModificationDate, getName, getPopulation, getSource, getTimezone, getZipCodes, isAdm, isCity, isCountry, isFullTextSearchable, populate, setAdm, setAdm1Code, setAdm1Name, setAdm2Code, setAdm2Name, setAdm3Code, setAdm3Name, setAdm4Code, setAdm4Name, setAlternateNames, setAsciiName, setCountryCode, setElevation, setFeatureClass, setFeatureCode, setFeatureId, setGtopo30, setId, setLocation, setModificationDate, setName, setPopulation, setSource, setTimezone, setZipCodes, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Country

public Country(GisFeature gisFeature)
Constructor that populate the Country with the gisFeature fields

Parameters:
gisFeature - The gisFeature from which we want to populate the Country

Country

public Country()
Default constructor (Needed by CGLib)


Country

public Country(String iso3166Alpha2Code,
               String iso3166Alpha3Code,
               int iso3166NumericCode)
Construct a country with the iso 3166 alpha-2 code, iso 3166 alpha-3 code, and iso 3166 numeric code

Parameters:
iso3166Alpha2Code - The iso 3166 alpha 2 code for this Country
iso3166Alpha3Code - The iso 3166 alpha3 code for this Country
iso3166NumericCode - The iso 3166 numeric code for this Country NOTE : The iso3166AlphaX codes will be automatically uppercased
Method Detail

addSpokenLanguage

public void addSpokenLanguage(Language lang)
Add a spoken language to the country. The language is described by its Alpha2 Code.

Parameters:
lang -

equals

public boolean equals(Object obj)
Overrides:
equals in class GisFeature

getArea

public Double getArea()
Country area in square Km

Returns:
The country area in square Km

getCurrency

public Currency getCurrency()
Returns the ISO 4217 Currency from the currency code. The code is not imported but processed : Currency.getInstance(java.util.Locale) Important : some currencies are NOT recognized by Currency.getInstance(java.util.Locale).

Returns:
The ISO 4217 Currency or null if the currencyCode is null or incorrect

getCurrencyCode

public String getCurrencyCode()
ISO 4217 currency code when possible. However, for some countries, there is no official ISO 4217 code, like Guernsey (GGP), and the information can be null sometimes when we're not sure of the currency (United States Minor Outlying Islands). This field is not unique, because some countries have the same currency. (Euro for instance..)

Returns:
The ISO 4217 currency code
See Also:
ISO 4217 Currency names , Guernsey Pound, United States Minor Outlying Islands

getEquivalentFipsCode

public String getEquivalentFipsCode()
This field is not supported yet. The equivalent fips Code. This is the same as the FIPS code, except that sometimes, there is no FIPS code for some entity (Aaland Islands), even if it is the same country than another one (finland). So in that case, Aaland island equivalent fips code will be set to FI

Returns:
The equivalent fips Code

getFipsCode

public String getFipsCode()
The FIPS 10.4 country code. This field can be null in some cases (when there is an ISO Code and no FIPS code, for instance). Note that these code is not the same as the ISO 3166 codes used by the U.N. and for Internet top-level country code domains.

Returns:
Returns the fipsCode.
See Also:
List Of FIPS Country Codes

getIso3166Alpha2Code

public String getIso3166Alpha2Code()
The ISO 3166 alpha-2 letter code(should be in upper case). We don't use the country code of the GisFeature because we want that fields as mandatory and the GisFeature one is not

Returns:
Returns the iso3166Alpha2Code.
See Also:
ISO 3166

getIso3166Alpha3Code

public String getIso3166Alpha3Code()
The ISO 3166 alpha-3 letter code (should be in upper case)

See Also:
ISO 3166

getIso3166NumericCode

public int getIso3166NumericCode()
Returns:
The ISO 3166 numeric code

getPhonePrefix

public String getPhonePrefix()
The Phone Prefix (e.g : 33..) without '+'

Returns:
The phone prefix

getPostalCodeMask

public String getPostalCodeMask()
Returns:
The postal Code Mask (ex : #####)

getSpokenLanguages

public List<Language> getSpokenLanguages()
All language spoken in this Country.

Returns:
the Language spoken in this Country
See Also:
Language

hashCode

public int hashCode()
Overrides:
hashCode in class GisFeature

setArea

public void setArea(Double area)
Parameters:
area -
See Also:
getArea()

setCurrencyCode

public void setCurrencyCode(String currencyCode)
Set the currency code for this country

Parameters:
currencyCode - The currencyCode to set
See Also:
getCurrencyCode()

setEquivalentFipsCode

public void setEquivalentFipsCode(String equivalentFipsCode)
Parameters:
equivalentFipsCode -
See Also:
getEquivalentFipsCode()

setFipsCode

public void setFipsCode(String fipsCode)
Parameters:
fipsCode - The fipsCode to set.
See Also:
getFipsCode()

setIso3166Alpha2Code

public void setIso3166Alpha2Code(String isoCode)
Set the iso3166 alpha-2 code. NOTE : The Code will be automaticaly uppercased, and the gisfeature code will be set automatically

Parameters:
isoCode - The iso3166 alpha-2 code to set in upper case.
See Also:
getIso3166Alpha2Code()

setIso3166Alpha3Code

public void setIso3166Alpha3Code(String iso3166Alpha3Code)
Note : The code will be automaticaly uppercased

Parameters:
iso3166Alpha3Code - The iso3166Alpha3Code to set (in upper case).
See Also:
getIso3166Alpha3Code()

setIso3166NumericCode

public void setIso3166NumericCode(int iso3166NumericCode)
Parameters:
iso3166NumericCode - The iso 3166 numeric code to set.
See Also:
getIso3166NumericCode()

setPhonePrefix

public void setPhonePrefix(String phonePrefix)
Parameters:
phonePrefix -
See Also:
getPhonePrefix()

setPostalCodeMask

public void setPostalCodeMask(String postalCodeMask)
Parameters:
postalCodeMask -
See Also:
getPostalCodeMask()

setSpokenLanguages

public void setSpokenLanguages(List<Language> languages)
Parameters:
languages -
See Also:
getSpokenLanguages()

addSpokenLanguages

public void addSpokenLanguages(List<Language> languages)
Parameters:
languages -
See Also:
getSpokenLanguages()

getCapitalName

public String getCapitalName()
Get the capital for this country

Returns:
the Capital for this country

setCapitalName

public void setCapitalName(String capitalName)
See Also:
getCapitalName()

getContinent

public String getContinent()
Returns The name of the continent this country belongs to

Returns:
The name of the continent this country belongs to

setContinent

public void setContinent(String continent)
See Also:
getContinent()

getCurrencyName

public String getCurrencyName()
Returns The name of the currency for this country. The name is not processed but imported from file.

Returns:
The name of the currency

setCurrencyName

public void setCurrencyName(String currencyName)
See Also:
getCurrencyName()

getPostalCodeRegex

public String getPostalCodeRegex()
Returns The regexp that every Zipcode for this country matches. it is useful to test if a zipcode is valid. this field is imported from file and is not tested. Please report any problems.

Returns:
The regexp that every zipcode for this country matches
See Also:
getPostalCodeMask()

setPostalCodeRegex

public void setPostalCodeRegex(String postalCodeRegex)
See Also:
getPostalCodeRegex()

getTld

public String getTld()
Returns the top level domain for this country with the starting point. (ex : .fr)

Returns:
the TLD for this Country
See Also:
TLD

setTld

public void setTld(String tld)
See Also:
getTld()

compareTo

public int compareTo(Country country)
compare the name of the country

Specified by:
compareTo in interface Comparable<Country>


Copyright © 2012. All Rights Reserved.