javax.microedition.location
Class AddressInfo

java.lang.Object
  extended by javax.microedition.location.AddressInfo

public class AddressInfo
extends Object

The AddressInfo class holds textual address information about a location. Typically the information is e.g. street address. The information is divided into fields (e.g. street, postal code, city, etc.). Defined field constants can be used to retrieve field data.

If the value of a field is not available, it is set to null.

The names of the fields use terms and definitions that are commonly used e.g. in the United States. Addresses for other countries should map these to the closest corresponding entities used in that country.

This class is only a container for the information. The getField method returns the value set for the defined field using the setField method. When the platform implementation returns AddressInfo objects, it MUST ensure that it only returns objects where the parameters have values set as described for their semantics in this class.

Below are some typical examples of addresses in different countries and how they map to the AddressInfo fields.

AddressInfo Field American Example British Example
EXTENSION Flat 5 The Oaks
STREET 10 Washington Street 20 Greenford Court
POSTAL_CODE 12345 AB1 9YZ
CITY Palo Alto Cambridge
COUNTY Santa Clara County Cambridgeshire
STATE California England
COUNTRY United States of America United Kingdom
COUNTRY_CODE US GB
DISTRICT
BUILDING_NAME
BUILDING_FLOOR
BUILDING_ROOM
BUILDING_ZONE
CROSSING1
CROSSING2
URL http://www.americanurl.com http://britishurl.co.uk
PHONE_NUMBER


Field Summary
static int BUILDING_FLOOR
          Address field denoting a building floor.
static int BUILDING_NAME
          Address field denoting a building name.
static int BUILDING_ROOM
          Address field denoting a building room.
static int BUILDING_ZONE
          Address field denoting a building zone
static int CITY
          Address field denoting town or city name.
static int COUNTRY
          Address field denoting country.
static int COUNTRY_CODE
          Address field denoting country as a two-letter ISO 3166-1 code.
static int COUNTY
          Address field denoting a county, which is an entity between a state and a city
static int CROSSING1
          Address field denoting a street in a crossing.
static int CROSSING2
          Address field denoting a street in a crossing.
static int DISTRICT
          Address field denoting a municipal district.
static int EXTENSION
          Address field denoting address extension, e.g. flat number.
static int PHONE_NUMBER
          Address field denoting a phone number for this place.
static int POSTAL_CODE
          Address field denoting zip or postal code.
static int STATE
          Address field denoting state or province.
static int STREET
          Address field denoting street name and number.
static int URL
          Address field denoting a URL for this place.
 
Constructor Summary
AddressInfo()
          Constructs an AddressInfo object with all the values of the fields set to null.
 
Method Summary
 String getField(int field)
          Returns the value of an address field.
 void setField(int field, String value)
          Sets the value of an address field.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUILDING_FLOOR

public static final int BUILDING_FLOOR
Address field denoting a building floor.

See Also:
Constant Field Values

BUILDING_NAME

public static final int BUILDING_NAME
Address field denoting a building name.

See Also:
Constant Field Values

BUILDING_ROOM

public static final int BUILDING_ROOM
Address field denoting a building room.

See Also:
Constant Field Values

BUILDING_ZONE

public static final int BUILDING_ZONE
Address field denoting a building zone

See Also:
Constant Field Values

CITY

public static final int CITY
Address field denoting town or city name.

See Also:
Constant Field Values

COUNTRY

public static final int COUNTRY
Address field denoting country.

See Also:
Constant Field Values

COUNTRY_CODE

public static final int COUNTRY_CODE
Address field denoting country as a two-letter ISO 3166-1 code.

See Also:
Constant Field Values

COUNTY

public static final int COUNTY
Address field denoting a county, which is an entity between a state and a city

See Also:
Constant Field Values

CROSSING1

public static final int CROSSING1
Address field denoting a street in a crossing.

See Also:
Constant Field Values

CROSSING2

public static final int CROSSING2
Address field denoting a street in a crossing.

See Also:
Constant Field Values

DISTRICT

public static final int DISTRICT
Address field denoting a municipal district.

See Also:
Constant Field Values

EXTENSION

public static final int EXTENSION
Address field denoting address extension, e.g. flat number.

See Also:
Constant Field Values

PHONE_NUMBER

public static final int PHONE_NUMBER
Address field denoting a phone number for this place.

See Also:
Constant Field Values

POSTAL_CODE

public static final int POSTAL_CODE
Address field denoting zip or postal code.

See Also:
Constant Field Values

STATE

public static final int STATE
Address field denoting state or province.

See Also:
Constant Field Values

STREET

public static final int STREET
Address field denoting street name and number.

See Also:
Constant Field Values

URL

public static final int URL
Address field denoting a URL for this place.

See Also:
Constant Field Values
Constructor Detail

AddressInfo

public AddressInfo()
Constructs an AddressInfo object with all the values of the fields set to null.

Method Detail

getField

public String getField(int field)
                throws IllegalArgumentException
Returns the value of an address field. If the field is not available null is returned.

Example: getField(AddressInfo.STREET) might return "113 Broadway" if the location is on Broadway, New York, or null if not available.

Parameters:
field - the ID of the field to be retrieved
Returns:
the address field string. If the field is not set, returns null.
Throws:
IllegalArgumentException - if the parameter field ID is not one of the constant values defined in this class
See Also:
setField(int, String)

setField

public void setField(int field,
                     String value)
              throws IllegalArgumentException
Sets the value of an address field.

Parameters:
field - the ID of the field to be set
value - the new value for the field. null is used to indicate that the field has no content.
Throws:
IllegalArgumentException - if the parameter field ID is not one of the constant values defined in this class
See Also:
getField(int)