Location

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.Object

The Location class is intended solely for use with items and is not applicable to other entities or functionalities.

Important

Fields 

FieldDescriptionModifier and Type
cityName of the city.java.lang.String
latitudeLatitudinal coordinate of the location, should be from -90 to 90.java.lang.Double
longitudeLongitudinal coordinate of the location, should be from -180 to 180.java.lang.Double
postalCodePostal code of the location.java.lang.String
stateProvinceCodeName of the state or province.java.lang.String

latitude 

1public java.lang.Double latitude

Latitudinal coordinate of the location, should be from -90 to 90.

longitude 

1public java.lang.Double longitude

Longitudinal coordinate of the location, should be from -180 to 180.

city 

1public java.lang.String city

Name of the city.

stateProvinceCode 

1public java.lang.String stateProvinceCode

Name of the state or province.

postalCode 

1public java.lang.String postalCode

Postal code of the location.

Constructors 

Location with Georgraphic Coordinates 

Creates a location with geographic coordinates.

1public Location(double latitude,
2                double longitude)

Parameters:

ParameterDescription
latitudeLatitudinal coordinate, should be from -90 to 90
longitudeLongitudinal coordinate, should be from -180 to 180

Location with City and State 

Creates a location with city and state.

1public Location(java.lang.String city,
2                java.lang.String stateProvinceCode)

Parameters:

ParameterDescription
cityCity name
stateProvinceCodeState or Province Code (e.g. MA)

Location with Postal Code 

Creates a location with postal code.

1public Location(java.lang.String postalCode)

Parameters:

ParameterDescription
postalCodePostal code

Methods 

MethodModifier and Type
fromJSONObject(org.json.JSONObject json)static Location

fromJSONObject 

1public static Location fromJSONObject(org.json.JSONObject json)