net.degreedays.api.data.impl
Class PostalCodeLocation

java.lang.Object
  extended by net.degreedays.api.data.Location
      extended by net.degreedays.api.data.GeographicLocation
          extended by net.degreedays.api.data.impl.PostalCodeLocation
All Implemented Interfaces:
java.io.Serializable

public final class PostalCodeLocation
extends GeographicLocation
implements java.io.Serializable

Specifies a location using a postal code (or zip code, post code, or postcode - the terminology depends on the country). The API servers will attempt to find the longitude/latitude location of the specified postal code, and from that point on will treat the location as if it were a 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 Summary
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.
 
Method Summary
 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.
 
Methods inherited from class net.degreedays.api.data.Location
equals, hashCode, longLat, postalCode, stationId
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PostalCodeLocation

public PostalCodeLocation(java.lang.String postalCode,
                          java.lang.String twoLetterIsoCountryCodeInUpperCase)
                   throws java.lang.IllegalArgumentException
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.

Parameters:
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.
Throws:
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.
Method Detail

postalCode

public 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).


countryCode

public 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.


toString

public java.lang.String toString()
Returns a non-null, non-empty string representation of this object for logging and debugging purposes.

The exact details of the representation are unspecified and subject to change.

Overrides:
toString in class java.lang.Object


www.degreedays.net/api/