|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.microedition.location.AddressInfo
public class AddressInfo
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. |
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 | |
---|---|
boolean |
equals(java.lang.Object obj)
Overriding the equals method in Object class
to compare the equality of values in two AddressInfo objects. |
java.lang.String |
getField(int field)
Returns the value of an address field. |
int |
hashCode()
Overriding the hashCode method in Object class. |
void |
setField(int field,
java.lang.String value)
Sets the value of an address field. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int EXTENSION
Address field denoting address extension, e.g. flat number.
public static final int STREET
Address field denoting street name and number.
public static final int POSTAL_CODE
Address field denoting zip or postal code.
public static final int CITY
Address field denoting town or city name.
public static final int COUNTY
Address field denoting a county, which is an entity between a state and a city.
public static final int STATE
Address field denoting state or province.
public static final int COUNTRY
Address field denoting country.
public static final int COUNTRY_CODE
Address field denoting country as a two-letter ISO 3166-1 code.
public static final int DISTRICT
Address field denoting a municipal district.
public static final int BUILDING_NAME
Address field denoting a building name.
public static final int BUILDING_FLOOR
Address field denoting a building floor.
public static final int BUILDING_ROOM
Address field denoting a building room.
public static final int BUILDING_ZONE
Address field denoting a building zone.
public static final int CROSSING1
Address field denoting a street in a crossing.
public static final int CROSSING2
Address field denoting a street in a crossing.
public static final int URL
Address field denoting a URL for this place.
public static final int PHONE_NUMBER
Address field denoting a phone number for this place.
Constructor Detail |
---|
public AddressInfo()
Constructs an AddressInfo
object with all the
values of the fields set to null
.
Method Detail |
---|
public java.lang.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.
field
- the ID of the field to be retrieved
null
.
java.lang.IllegalArgumentException
- if the parameter field
ID
is not one of the constant values defined in this classsetField(int, java.lang.String)
public void setField(int field, java.lang.String value)
Sets the value of an address field.
field
- the ID of the field to be setvalue
- the new value for the field, null
is used to indicate that the field has no content.
java.lang.IllegalArgumentException
- if the parameter field
ID is
not one of the constant values defined in this classgetField(int)
public boolean equals(java.lang.Object obj)
Overriding the equals
method in Object
class
to compare the equality of values in two AddressInfo
objects.
equals
in class java.lang.Object
obj
- object to which the comparison is done
true
if all fields in the objects are equal,
else false
public int hashCode()
Overriding the hashCode
method in Object
class.
The method returns a hash code value for the address info object. Two
AddressInfo
objects that are equal must have
the same hash code. For more information see
java.lang.Object.hashCode()
method.
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |