Package com.google.maps
Class NearbySearchRequest
- java.lang.Object
-
- com.google.maps.NearbySearchRequest
-
- All Implemented Interfaces:
PendingResult<PlacesSearchResponse>
public class NearbySearchRequest extends java.lang.Object
A Nearby Search request.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NearbySearchRequest.Response
-
Nested classes/interfaces inherited from interface com.google.maps.PendingResult
PendingResult.Callback<T>
-
-
Constructor Summary
Constructors Constructor Description NearbySearchRequest(GeoApiContext context)
Constructs a newNearbySearchRequest
.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description T
await()
Performs the request synchronously.T
awaitIgnoreError()
Performs the request synchronously, ignoring exceptions while performing the request and errors returned by the server.void
cancel()
Attempts to cancel the request.A
channel(java.lang.String channel)
A channel to pass with the request.A
custom(java.lang.String parameter, java.lang.String value)
Custom parameter.A
experienceIds(java.lang.String... experienceIds)
Sets the value for the HTTP header field nameHttpHeaders.X_GOOG_MAPS_EXPERIENCE_ID
.A
header(java.lang.String key, java.lang.String value)
Sets the header namedkey
tovalue
.NearbySearchRequest
keyword(java.lang.String keyword)
Specifies a term to be matched against all content that Google has indexed for this place.A
language(java.lang.String language)
The language in which to return results.NearbySearchRequest
location(LatLng location)
Specifies the latitude/longitude around which to retrieve place information.NearbySearchRequest
maxPrice(PriceLevel priceLevel)
Restricts to places that are at most this price level.NearbySearchRequest
minPrice(PriceLevel priceLevel)
Restricts to places that are at least this price level.NearbySearchRequest
name(java.lang.String name)
Specifies one or more terms to be matched against the names of places, separated by spaces.NearbySearchRequest
openNow(boolean openNow)
Restricts to only those places that are open for business at the time the query is sent.NearbySearchRequest
pageToken(java.lang.String nextPageToken)
Returns the next 20 results from a previously run search.protected A
param(java.lang.String key, int val)
protected A
param(java.lang.String key, com.google.maps.internal.StringJoin.UrlValue val)
protected A
param(java.lang.String key, java.lang.String val)
protected A
paramAddToList(java.lang.String key, com.google.maps.internal.StringJoin.UrlValue val)
protected A
paramAddToList(java.lang.String key, java.lang.String val)
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>>
params()
NearbySearchRequest
radius(int distance)
Specifies the distance (in meters) within which to return place results.NearbySearchRequest
rankby(RankBy ranking)
Specifies the order in which results are listed.void
setCallback(PendingResult.Callback<T> callback)
NearbySearchRequest
type(PlaceType type)
Restricts the results to places matching the specified type.NearbySearchRequest
type(PlaceType... types)
Deprecated.Multiple search types are ignored by the Places API.protected void
validateRequest()
-
-
-
Constructor Detail
-
NearbySearchRequest
public NearbySearchRequest(GeoApiContext context)
Constructs a newNearbySearchRequest
.- Parameters:
context
- TheGeoApiContext
to make requests through.
-
-
Method Detail
-
location
public NearbySearchRequest location(LatLng location)
Specifies the latitude/longitude around which to retrieve place information.- Parameters:
location
- The location to use as the center of the Nearby Search.- Returns:
- Returns this
NearbyApiRequest
for call chaining.
-
radius
public NearbySearchRequest radius(int distance)
Specifies the distance (in meters) within which to return place results. The maximum allowed radius is 50,000 meters. Note that radius must not be included ifrankby=DISTANCE
is specified.- Parameters:
distance
- The distance in meters around thelocation(LatLng)
to search.- Returns:
- Returns this
NearbyApiRequest
for call chaining.
-
rankby
public NearbySearchRequest rankby(RankBy ranking)
Specifies the order in which results are listed.- Parameters:
ranking
- The rank by method.- Returns:
- Returns this
NearbyApiRequest
for call chaining.
-
keyword
public NearbySearchRequest keyword(java.lang.String keyword)
Specifies a term to be matched against all content that Google has indexed for this place. This includes but is not limited to name, type, and address, as well as customer reviews and other third-party content.- Parameters:
keyword
- The keyword to search for.- Returns:
- Returns this
NearbyApiRequest
for call chaining.
-
minPrice
public NearbySearchRequest minPrice(PriceLevel priceLevel)
Restricts to places that are at least this price level.- Parameters:
priceLevel
- The price level to set as minimum.- Returns:
- Returns this
NearbyApiRequest
for call chaining.
-
maxPrice
public NearbySearchRequest maxPrice(PriceLevel priceLevel)
Restricts to places that are at most this price level.- Parameters:
priceLevel
- The price level to set as maximum.- Returns:
- Returns this
NearbyApiRequest
for call chaining.
-
name
public NearbySearchRequest name(java.lang.String name)
Specifies one or more terms to be matched against the names of places, separated by spaces.- Parameters:
name
- Search for Places with this name.- Returns:
- Returns this
NearbyApiRequest
for call chaining.
-
openNow
public NearbySearchRequest openNow(boolean openNow)
Restricts to only those places that are open for business at the time the query is sent.- Parameters:
openNow
- Whether to restrict to places that are open.- Returns:
- Returns this
NearbyApiRequest
for call chaining.
-
pageToken
public NearbySearchRequest pageToken(java.lang.String nextPageToken)
Returns the next 20 results from a previously run search. SettingpageToken
will execute a search with the same parameters used previously — all parameters other thanpageToken
will be ignored.- Parameters:
nextPageToken
- The page token from a previous result.- Returns:
- Returns this
NearbyApiRequest
for call chaining.
-
type
public NearbySearchRequest type(PlaceType type)
Restricts the results to places matching the specified type.- Parameters:
type
- ThePlaceType
to restrict results to.- Returns:
- Returns this
NearbyApiRequest
for call chaining.
-
type
@Deprecated public NearbySearchRequest type(PlaceType... types)
Deprecated.Multiple search types are ignored by the Places API.Restricts the results to places matching the specified type. Provides support for multiple types.- Parameters:
types
- ThePlaceType
s to restrict results to.- Returns:
- Returns this
NearbyApiRequest
for call chaining.
-
validateRequest
protected void validateRequest()
-
setCallback
public final void setCallback(PendingResult.Callback<T> callback)
Description copied from interface:PendingResult
Performs the request asynchronously, callingonResult
oronFailure
after the request has been completed.- Specified by:
setCallback
in interfacePendingResult<T>
- Parameters:
callback
- The callback to call on completion.
-
await
public final T await() throws ApiException, java.lang.InterruptedException, java.io.IOException
Description copied from interface:PendingResult
Performs the request synchronously.- Specified by:
await
in interfacePendingResult<T>
- Returns:
- The result.
- Throws:
ApiException
- Thrown if the API Returned result is an error.java.lang.InterruptedException
- Thrown when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted.java.io.IOException
- Thrown when an I/O exception of some sort has occurred.
-
awaitIgnoreError
public final T awaitIgnoreError()
Description copied from interface:PendingResult
Performs the request synchronously, ignoring exceptions while performing the request and errors returned by the server.- Specified by:
awaitIgnoreError
in interfacePendingResult<T>
- Returns:
- The result, or null if there was any error or exception ignored.
-
cancel
public final void cancel()
Description copied from interface:PendingResult
Attempts to cancel the request.- Specified by:
cancel
in interfacePendingResult<T>
-
header
public A header(java.lang.String key, java.lang.String value)
Sets the header namedkey
tovalue
. If this request already has any headers with the same key, the value is replaced.- Parameters:
key
- the header keyvalue
- the header value- Returns:
- this request
-
experienceIds
public A experienceIds(java.lang.String... experienceIds)
Sets the value for the HTTP header field nameHttpHeaders.X_GOOG_MAPS_EXPERIENCE_ID
. Passing null to this method will unset the experienceId header field.- Parameters:
experienceIds
- The experience IDs
-
param
protected A param(java.lang.String key, java.lang.String val)
-
param
protected A param(java.lang.String key, int val)
-
param
protected A param(java.lang.String key, com.google.maps.internal.StringJoin.UrlValue val)
-
paramAddToList
protected A paramAddToList(java.lang.String key, java.lang.String val)
-
paramAddToList
protected A paramAddToList(java.lang.String key, com.google.maps.internal.StringJoin.UrlValue val)
-
params
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> params()
-
language
public final A language(java.lang.String language)
The language in which to return results. Note that we often update supported languages so this list may not be exhaustive.- Parameters:
language
- The language code, e.g. "en-AU" or "es".- Returns:
- Returns the request for call chaining.
- See Also:
- List of supported domain languages
-
channel
public A channel(java.lang.String channel)
A channel to pass with the request. channel is used by Google Maps API for Work users to be able to track usage across different applications with the same clientID. See Premium Plan Usage Rates and Limits.- Parameters:
channel
- String to pass with the request for analytics.- Returns:
- Returns the request for call chaining.
-
custom
public A custom(java.lang.String parameter, java.lang.String value)
Custom parameter. For advanced usage only.- Parameters:
parameter
- The name of the custom parameter.value
- The value of the custom parameter.- Returns:
- Returns the request for call chaining.
-
-