@Override
  protected void validateRequest() {

    // All other parameters are ignored if pagetoken is specified.
    if (params().containsKey("pagetoken")) {
      return;
    }

    if (!params().containsKey("query") && !params().containsKey("type")) {
      throw new IllegalArgumentException(
          "Request must contain 'query' or a 'pageToken'. If a 'type' is specified 'query' becomes optional.");
    }

    if (params().containsKey("location") && !params().containsKey("radius")) {
      throw new IllegalArgumentException(
          "Request must contain 'radius' parameter when it contains a 'location' parameter.");
    }
  }
Restricts the results to places matching the specified type.

@param type The type of place to restrict the results with.
@return Returns this {@code TextSearchRequest} for call chaining.
src/main/java/com/google/maps/TextSearchRequest.java