@Override
  protected void validateRequest() {

    // If pagetoken is included, all other parameters are ignored.
    if (params().containsKey("pagetoken")) {
      return;
    }

    // radius must not be included if rankby=distance
    if (params().containsKey("rankby")
        && params().get("rankby").get(0).equals(RankBy.DISTANCE.toString())
        && params().containsKey("radius")) {
      throw new IllegalArgumentException("Request must not contain radius with rankby=distance");
    }

    // If rankby=distance is specified, then one or more of keyword, name, or type is required.
    if (params().containsKey("rankby")
        && params().get("rankby").get(0).equals(RankBy.DISTANCE.toString())
        && !params().containsKey("keyword")
        && !params().containsKey("name")
        && !params().containsKey("type")) {
      throw new IllegalArgumentException(
          "With rankby=distance is specified, then one or more of keyword, name, or type is required");
    }
  }
Restricts the results to places matching the specified type. Provides support for multiple
types.

@deprecated Multiple search types are ignored by the Places API.
@param types The {@link PlaceType}s to restrict results to.
@return Returns this {@code NearbyApiRequest} for call chaining.
src/main/java/com/google/maps/NearbySearchRequest.java