类 DirectionsResponse

java.lang.Object
ai.nextbillion.kits.directions.models.DirectionsJsonObject
ai.nextbillion.kits.directions.models.DirectionsResponse
所有已实现的接口:
Serializable

public abstract class DirectionsResponse extends DirectionsJsonObject
This is the root Nbmap Directions API response. Inside this class are several nested classes chained together to make up a similar structure to the original APIs JSON response.
另请参阅:
  • 构造器详细资料

    • DirectionsResponse

      public DirectionsResponse()
  • 方法详细资料

    • builder

      @NonNull public static DirectionsResponse.Builder builder()
      Create a new instance of this class by using the DirectionsResponse.Builder class.
      返回:
      this classes DirectionsResponse.Builder for creating a new instance
    • code

      @NonNull public abstract String code()
      String indicating the state of the response. This is a separate code than the HTTP status code. On normal valid responses, the value will be Ok. The possible responses are listed below:
      • Ok:200 Normal success case
      • NoRoute: 200 There was no route found for the given coordinates. Check for impossible routes (e.g. routes over oceans without ferry connections).
      • NoSegment: 200 No road segment could be matched for coordinates. Check for coordinates too far away from a road.
      • ProfileNotFound: 404 Use a valid profile as described above
      • InvalidInput: 422
      返回:
      a string with one of the given values described in the list above
    • message

      @Nullable public abstract String message()
      Optionally shows up in a directions response if an error or something unexpected occurred.
      返回:
      a string containing the message API Directions response with if an error occurred
    • waypoints

      @Nullable public abstract List<DirectionsWaypoint> waypoints()
      List of DirectionsWaypoint objects. Each waypoint is an input coordinate snapped to the road and path network. The waypoint appear in the list in the order of the input coordinates.
      返回:
      list of DirectionsWaypoint objects ordered from start of route till the end
    • routes

      @NonNull public abstract List<DirectionsRoute> routes()
      List containing all the different route options. It's ordered by descending recommendation rank. In other words, object 0 in the List is the highest recommended route. if you don't setAlternatives to true (default is false) in your builder this should always be a List of size 1. At most this will return 2 DirectionsRoute objects.
      返回:
      list of DirectionsRoute objects
    • country_code

      @Nullable public abstract String country_code()
      A string telling you of the local country code
      返回:
      the country code
    • uuid

      @Nullable public abstract String uuid()
      A universally unique identifier (UUID) for identifying and executing a similar specific route in the future.
      返回:
      a String representing the UUID given by the directions request
    • toBuilder

      public abstract DirectionsResponse.Builder toBuilder()
      Convert the current DirectionsResponse to its builder holding the currently assigned values. This allows you to modify a single property and then rebuild the object resulting in an updated and modified DirectionsResponse.
      返回:
      a DirectionsResponse.Builder with the same values set to match the ones defined in this DirectionsResponse
    • typeAdapter

      public static com.google.gson.TypeAdapter<DirectionsResponse> typeAdapter(com.google.gson.Gson gson)
      Gson type adapter for parsing Gson to this class.
      参数:
      gson - the built Gson object
      返回:
      the type adapter for this class
    • fromJson

      public static DirectionsResponse fromJson(String json)
      Create a new instance of this class by passing in a formatted valid JSON String.
      参数:
      json - a formatted valid JSON string defining a GeoJson Directions Response
      返回:
      a new instance of this class defined by the values passed inside this static factory method