biz.janux.geography
Interface PostalAddress

All Superinterfaces:
Cloneable, ContactMethod, Persistent, Serializable

public interface PostalAddress
extends ContactMethod

Represents a Postal Address; this class aims to be independent of how an address may be represented in an individual country; StateProvince, Country and City are represented as objects rather than Strings; refer to the package documentation for biz.janux.geography for more information on the relationship between City, StateProvince and Country

This interface also provides getCityAsString, getStateProvinceAsString, and getCountryAsString so that implementing classes can receive text values representing the geographical entities, for example from a UI form. These methods can also be used in cases where it is not possible or desirable to create the different geographical entitie. For example, it may be that the Country is entered by-hand, rather than through a pick list, and may contain a spelling other than the one that exists in the pre-populated Country tables. In such case, it would not be desireable to create a new Country entity for the different spellings, yet it is necessary to store whatever String was entered for the Country. In effect, via these methods it is possible to completely bypass the use of the Geographical entities, if in a given implementation it is desireable or necessary to store all address fields as text.

Finally, as a convenience feature, this interface provides the methods getCityName, getStateProvinceCode, getStateProvinceName, and getCountryName, which makes it possible to retrieve City, State, Country Strings without concern as to whether these are stored as entities or as simple Strings

Note that the plan is to eventually make the 'Name' fields of the different geographical entities localizable, For example, it may be necessary to display a City both as 'Munich' or 'Munchen', depending on the language of the site. Hence, rather than being a single-valued field, name fields will be maps of strings keyed by Language, Country, and Variant code, in the usual java way. We foresee that such future implementation will still provide the ability to only use a single language when desireable, and that the methods which do not specify a locale will be interpreted to be requesting the default locale.

Version:
$Revision: 1.12 $ - $Date: 2008-03-27 00:51:37 $
Author:
Philippe Paravicini

Field Summary
 
Fields inherited from interface org.janux.bus.persistence.Persistent
UNSAVED_ID
 
Method Summary
 City getCity()
          The City where the PostalAddress is located; may be null if it is not possible to ascertain the City entity in with this Postal Address is located; in such case, the city may be stored as a String in getCityAsString.
 String getCityAsString()
           
 String getCityName()
           
 Country getCountry()
          Country in which this PostalAddress is located; if getCity or getStateProvince fields are not null, this Country must be the same as the one in which the City and StateProvince are located
 String getCountryAsString()
           
 String getCountryCode()
           
 String getCountryName()
           
 String getLine1()
           
 String getLine2()
           
 String getLine3()
           
 String getPostalCode()
           
 StateProvince getStateProvince()
          StateProvince in which this PostalAddress is located; if getCity or getCountry fields ane not null, all three of these entities must be congruent.
 String getStateProvinceAsString()
           
 String getStateProvinceCode()
           
 String getStateProvinceName()
           
 void setCity(City o)
           
 void setCityAsString(String s)
           
 void setCountry(Country o)
           
 void setCountryAsString(String s)
           
 void setLine1(String s)
           
 void setLine2(String s)
           
 void setLine3(String s)
           
 void setPostalCode(String s)
           
 void setStateProvince(StateProvince o)
           
 void setStateProvinceAsString(String s)
           
 
Methods inherited from interface biz.janux.people.ContactMethod
clone
 
Methods inherited from interface org.janux.bus.persistence.Persistent
getId, setId
 

Method Detail

getLine1

String getLine1()

setLine1

void setLine1(String s)

getLine2

String getLine2()

setLine2

void setLine2(String s)

getLine3

String getLine3()

setLine3

void setLine3(String s)

getCity

City getCity()
The City where the PostalAddress is located; may be null if it is not possible to ascertain the City entity in with this Postal Address is located; in such case, the city may be stored as a String in getCityAsString. If the City is not null, the getStateProvince and getCountry fields must be the same as the StateProvince/Country of the City.


setCity

void setCity(City o)

getStateProvince

StateProvince getStateProvince()
StateProvince in which this PostalAddress is located; if getCity or getCountry fields ane not null, all three of these entities must be congruent.


setStateProvince

void setStateProvince(StateProvince o)

getPostalCode

String getPostalCode()

setPostalCode

void setPostalCode(String s)

getCountry

Country getCountry()
Country in which this PostalAddress is located; if getCity or getStateProvince fields are not null, this Country must be the same as the one in which the City and StateProvince are located


setCountry

void setCountry(Country o)

getCityName

String getCityName()
Returns:
Convenience method that returns, if it exists, this.getCity().getName(); or, if getCity() is null, it returns getCityAsString().

getStateProvinceName

String getStateProvinceName()
Returns:
Convenience method that returns, if it exists, this.getStateProvince().getName(); or, if getStateProvince() is null, it returns this.getStateProvinceNameAsString().

getStateProvinceCode

String getStateProvinceCode()
Returns:
Convenience method that returns, if it exists, this.getStateProvince().getCode(); or, if getStateProvince() is null, it returns this.getStateProvinceNameAsString().

getCountryName

String getCountryName()
Returns:
Convenience method that returns, if it exists, this.getCountry().getName(); or, if getCountry() is null, it returns this.getCountryAsString().

getCountryCode

String getCountryCode()
Returns:
Convenience method that returns, if it exists, this.getCountry().getCode(); or, if getCountry() is null, it returns this.getCountryAsString().

getCityAsString

String getCityAsString()
Returns:
Returns a String used to represent the City, in the event that this PostalAddress has not been related to a City entity

setCityAsString

void setCityAsString(String s)
Parameters:
s - a String that can be used to represent a city

getStateProvinceAsString

String getStateProvinceAsString()
Returns:
Returns a String used to represent the name of a StateProvince, in the event that this PostalAddress has not been related to a StateProvince entity

setStateProvinceAsString

void setStateProvinceAsString(String s)
Parameters:
s - a String that can be used to represent a state or a province

getCountryAsString

String getCountryAsString()
Returns:
Returns a String used to represent the Country, in the event that this PostalAddress has not been related to a Country entity

setCountryAsString

void setCountryAsString(String s)
Parameters:
s - a String that can be used to represent a country


Copyright © 2005-2013 Janux. All Rights Reserved.