Package com.google.maps
Class TextSearchRequest
- java.lang.Object
-
- com.google.maps.TextSearchRequest
-
- All Implemented Interfaces:
PendingResult<PlacesSearchResponse>
public class TextSearchRequest extends java.lang.ObjectA Text Search request.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTextSearchRequest.Response-
Nested classes/interfaces inherited from interface com.google.maps.PendingResult
PendingResult.Callback<T>
-
-
Constructor Summary
Constructors Constructor Description TextSearchRequest(GeoApiContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tawait()Performs the request synchronously.TawaitIgnoreError()Performs the request synchronously, ignoring exceptions while performing the request and errors returned by the server.voidcancel()Attempts to cancel the request.Achannel(java.lang.String channel)A channel to pass with the request.Acustom(java.lang.String parameter, java.lang.String value)Custom parameter.Alanguage(java.lang.String language)The language in which to return results.TextSearchRequestlocation(LatLng location)Specifies the latitude/longitude around which to retrieve place information.TextSearchRequestmaxPrice(PriceLevel priceLevel)Restricts to places that are at most this price level.TextSearchRequestminPrice(PriceLevel priceLevel)Restricts to places that are at least this price level.TextSearchRequestname(java.lang.String name)Specifies one or more terms to be matched against the names of places, separated with space characters.TextSearchRequestopenNow(boolean openNow)Restricts to only those places that are open for business at the time the query is sent.TextSearchRequestpageToken(java.lang.String nextPageToken)Returns the next 20 results from a previously run search.protected Aparam(java.lang.String key, int val)protected Aparam(java.lang.String key, com.google.maps.internal.StringJoin.UrlValue val)protected Aparam(java.lang.String key, java.lang.String val)protected AparamAddToList(java.lang.String key, com.google.maps.internal.StringJoin.UrlValue val)protected AparamAddToList(java.lang.String key, java.lang.String val)protected java.util.Map<java.lang.String,java.util.List<java.lang.String>>params()TextSearchRequestquery(java.lang.String query)Specifies the text string on which to search, for example:"restaurant".TextSearchRequestradius(int radius)Specifies the distance (in meters) within which to bias place results.TextSearchRequestrankby(RankBy ranking)Specifies the order in which results are listed.TextSearchRequestregion(java.lang.String region)Region used to influence search results.voidsetCallback(PendingResult.Callback<T> callback)TextSearchRequesttype(PlaceType type)Restricts the results to places matching the specified type.protected voidvalidateRequest()
-
-
-
Constructor Detail
-
TextSearchRequest
public TextSearchRequest(GeoApiContext context)
-
-
Method Detail
-
query
public TextSearchRequest query(java.lang.String query)
Specifies the text string on which to search, for example:"restaurant".- Parameters:
query- The query string to search for.- Returns:
- Returns this
TextSearchRequestfor call chaining.
-
location
public TextSearchRequest location(LatLng location)
Specifies the latitude/longitude around which to retrieve place information.- Parameters:
location- The location of the center of the search.- Returns:
- Returns this
TextSearchRequestfor call chaining.
-
region
public TextSearchRequest region(java.lang.String region)
Region used to influence search results. This parameter will only influence, not fully restrict, search results. If more relevant results exist outside of the specified region, they may be included. When this parameter is used, the country name is omitted from the resulting formatted_address for results in the specified region.- Parameters:
region- The ccTLD two-letter code of the region.- Returns:
- Returns this
TextSearchRequestfor call chaining.
-
radius
public TextSearchRequest radius(int radius)
Specifies the distance (in meters) within which to bias place results.- Parameters:
radius- The radius of the search bias.- Returns:
- Returns this
TextSearchRequestfor call chaining.
-
minPrice
public TextSearchRequest minPrice(PriceLevel priceLevel)
Restricts to places that are at least this price level.- Parameters:
priceLevel- The minimum price level to restrict results with.- Returns:
- Returns this
TextSearchRequestfor call chaining.
-
maxPrice
public TextSearchRequest maxPrice(PriceLevel priceLevel)
Restricts to places that are at most this price level.- Parameters:
priceLevel- The maximum price leve to restrict results with.- Returns:
- Returns this
TextSearchRequestfor call chaining.
-
name
public TextSearchRequest name(java.lang.String name)
Specifies one or more terms to be matched against the names of places, separated with space characters.- Parameters:
name- The name to search for.- Returns:
- Returns this
TextSearchRequestfor call chaining.
-
openNow
public TextSearchRequest 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 this search to open places.- Returns:
- Returns this
TextSearchRequestfor call chaining.
-
pageToken
public TextSearchRequest pageToken(java.lang.String nextPageToken)
Returns the next 20 results from a previously run search. Setting pageToken will execute a search with the same parameters used previously — all parameters other than pageToken will be ignored.- Parameters:
nextPageToken- ApageTokenfrom a prior result.- Returns:
- Returns this
TextSearchRequestfor call chaining.
-
rankby
public TextSearchRequest rankby(RankBy ranking)
Specifies the order in which results are listed.- Parameters:
ranking- The rank by method.- Returns:
- Returns this
TextSearchRequestfor call chaining.
-
type
public TextSearchRequest type(PlaceType type)
Restricts the results to places matching the specified type.- Parameters:
type- The type of place to restrict the results with.- Returns:
- Returns this
TextSearchRequestfor call chaining.
-
validateRequest
protected void validateRequest()
-
setCallback
public final void setCallback(PendingResult.Callback<T> callback)
Description copied from interface:PendingResultPerforms the request asynchronously, callingonResultoronFailureafter the request has been completed.- Specified by:
setCallbackin interfacePendingResult<T>- Parameters:
callback- The callback to call on completion.
-
await
public final T await() throws ApiException, java.lang.InterruptedException, java.io.IOExceptionDescription copied from interface:PendingResultPerforms the request synchronously.- Specified by:
awaitin 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:PendingResultPerforms the request synchronously, ignoring exceptions while performing the request and errors returned by the server.- Specified by:
awaitIgnoreErrorin interfacePendingResult<T>- Returns:
- The result, or null if there was any error or exception ignored.
-
cancel
public final void cancel()
Description copied from interface:PendingResultAttempts to cancel the request.- Specified by:
cancelin interfacePendingResult<T>
-
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.
-
-