public final class PostalCodeLocation extends GeographicLocation implements java.io.Serializable
LongLatLocation
(see the notes for that class for more relevant information).Instances of this class are immutable. You can safely reuse them and call them from multiple threads at once.
Constructor and Description |
---|
PostalCodeLocation(java.lang.String postalCode,
java.lang.String twoLetterIsoCountryCodeInUpperCase)
Constructs a
PostalCodeLocation object with a postal code
(or zip code, post code, or postcode) and a two-letter country code
representing the country that the postal code belongs to. |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
countryCode()
Returns the non-null two-letter upper-case ISO 3166-1-alpha-2 country code of the country that the postal code
belongs to.
|
java.lang.String |
postalCode()
Returns the non-null, non-empty postal code (or zip code, post code, or
postcode - the terminology depends on the country).
|
java.lang.String |
toString()
Returns a non-null, non-empty string representation of this object for logging and debugging purposes.
|
public PostalCodeLocation(java.lang.String postalCode, java.lang.String twoLetterIsoCountryCodeInUpperCase) throws java.lang.IllegalArgumentException
PostalCodeLocation
object with a postal code
(or zip code, post code, or postcode) and a two-letter country code
representing the country that the postal code belongs to.postalCode
- the non-null, non-empty postal code (or zip code, post
code, or postcode) of the location you want data for. Cannot be
longer than 16 characters (a length that we believe allows for all
current postal codes worldwide), and cannot contain any characters
other than [- 0-9a-zA-Z]
.twoLetterIsoCountryCodeInUpperCase
- the ISO 3166-1-alpha-2 country code of the country that
postalCode
belongs to. It must be a two-character
string comprised of only characters A-Z (i.e. upper case only).
For example, pass "US" if postalCode
is a US zip
code, pass "GB" (for "Great Britain") if postalCode
is a UK post code, and pass "CA" if postalCode
is a
Canadian zip code.java.lang.NullPointerException
- if postalCode
or
twoLetterIsoCountryCodeInUpperCase
is
null
.java.lang.IllegalArgumentException
- if tests indicate that
postalCode
or
twoLetterIsoCountryCodeInUpperCase
fails to match
the specifications detailed above.public java.lang.String postalCode()
public java.lang.String countryCode()
public java.lang.String toString()
The exact details of the representation are unspecified and subject to change.
toString
in class java.lang.Object
See www.degreedays.net/api/ for more about the Degree Days.net API.
You can sign up for a Degree Days.net API account and read the integration guide that is useful and applicable whether you are using Java or not.