Newer Version Available
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
Use the Location class to associate location information with an Item. It serves use cases such as filtering products based on availability in specific areas.
1public class Location
2extends java.lang.ObjectThe Location class is intended solely for use with items and is not applicable to other entities or functionalities.
Important
| Field | Description | Modifier and Type |
|---|---|---|
city | Name of the city. | java.lang.String |
latitude | Latitudinal coordinate of the location, should be from -90 to 90. | java.lang.Double |
longitude | Longitudinal coordinate of the location, should be from -180 to 180. | java.lang.Double |
postalCode | Postal code of the location. | java.lang.String |
stateProvinceCode | Name of the state or province. | java.lang.String |
1public java.lang.Double latitudeLatitudinal coordinate of the location, should be from -90 to 90.
1public java.lang.Double longitudeLongitudinal coordinate of the location, should be from -180 to 180.
1public java.lang.String cityName of the city.
1public java.lang.String stateProvinceCodeName of the state or province.
1public java.lang.String postalCodePostal code of the location.
Creates a location with geographic coordinates.
1public Location(double latitude,
2 double longitude)Parameters:
| Parameter | Description |
|---|---|
latitude | Latitudinal coordinate, should be from -90 to 90 |
longitude | Longitudinal coordinate, should be from -180 to 180 |
Creates a location with city and state.
1public Location(java.lang.String city,
2 java.lang.String stateProvinceCode)Parameters:
| Parameter | Description |
|---|---|
city | City name |
stateProvinceCode | State or Province Code (e.g. MA) |
Creates a location with postal code.
1public Location(java.lang.String postalCode)Parameters:
| Parameter | Description |
|---|---|
postalCode | Postal code |
| Method | Modifier and Type |
|---|---|
fromJSONObject(org.json.JSONObject json) | static Location |
1public static Location fromJSONObject(org.json.JSONObject json)Newer Version Available