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.

NOTE: The fields are identified using integers that have constant definitions in this class. The EG has considered also an alternative of using strings to identify the field, potentially providing easier extensibility (for private extensions). Currently the conclusion is to use integers.

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

AddressInfo FieldAmerican ExampleBritish Example
EXTENSIONFlat 5The Oaks
STREET10 Washington Street20 Greenford Court
POSTAL_CODE12345AB1 9YZ
CITYPalo AltoCambridge
COUNTYSanta Clara CountyCambridgeshire
STATECaliforniaEngland
COUNTRYUnited States of AmericaUnited Kingdom
COUNTRY_CODEUSGB
DISTRICT
BUILDING_NAME
BUILDING_FLOOR
BUILDING_ROOM
BUILDING_ZONE
CROSSING1
CROSSING2
URLhttp://www.americanurl.comhttp://britishurl.co.uk
PHONE_NUMBER

Since:
BlackBerry API 4.0.2

Field Summary
static int BUILDING_FLOOR
          Address field denoting building floor.
static int BUILDING_NAME
          Address field denoting building name.
static int BUILDING_ROOM
          Address field denoting 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()
           
 
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

EXTENSION

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

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

STREET

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

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

POSTAL_CODE

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

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

CITY

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

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

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
Since:
BlackBerry API 4.0.2

STATE

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

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

COUNTRY

public static final int COUNTRY
Address field denoting country.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

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
Since:
BlackBerry API 4.0.2

DISTRICT

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

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

BUILDING_NAME

public static final int BUILDING_NAME
Address field denoting building name.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

BUILDING_FLOOR

public static final int BUILDING_FLOOR
Address field denoting building floor.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

BUILDING_ROOM

public static final int BUILDING_ROOM
Address field denoting building room.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

BUILDING_ZONE

public static final int BUILDING_ZONE
Address field denoting a building zone

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

CROSSING1

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

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

CROSSING2

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

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

URL

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

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2

PHONE_NUMBER

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

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.2


Constructor Detail

AddressInfo

public AddressInfo()
Since:
BlackBerry API 4.0.2


Method Detail

getField

public String getField(int field)

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:
AddressInfo.setField(int, String)
Since:
BlackBerry API 4.0.2

setField

public void setField(int field,
                     String value)

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:
AddressInfo.getField(int)
Since:
BlackBerry API 4.0.2





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal