Class DistanceMatrixElement

  • All Implemented Interfaces:
    java.io.Serializable

    public class DistanceMatrixElement
    extends java.lang.Object
    implements java.io.Serializable
    A single result corresponding to an origin/destination pair in a Distance Matrix response.

    Be sure to check the status for each element, as a matrix response can have a mix of successful and failed elements depending on the connectivity of the origin and destination.

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      Distance distance
      distance indicates the total distance covered by this leg.
      Duration duration
      The total duration of this leg.
      Duration durationInTraffic
      The length of time to travel this route, based on current and historical traffic conditions.
      Fare fare
      fare contains information about the fare (that is, the ticket costs) on this route.
      DistanceMatrixElementStatus status
      The status of the request for this origin/destination pair.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • duration

        public Duration duration
        The total duration of this leg.
      • durationInTraffic

        public Duration durationInTraffic
        The length of time to travel this route, based on current and historical traffic conditions. The duration in traffic will only be returned if all of the following are true:
        1. The request includes a departureTime parameter.
        2. The request includes a valid API key or a valid Google Maps APIs Premium Plan client ID and signature.
        3. Traffic conditions are available for the requested route.
        4. The mode parameter is set to driving.
      • distance

        public Distance distance
        distance indicates the total distance covered by this leg.
      • fare

        public Fare fare
        fare contains information about the fare (that is, the ticket costs) on this route.
    • Constructor Detail

      • DistanceMatrixElement

        public DistanceMatrixElement()
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object