001 package com.google.gwt.maps.client.services;
002
003 import com.google.gwt.core.client.JavaScriptObject;
004
005 /**
006 * A single element of a response to a DistanceMatrixService request, which contains the duration and distance from one origin to one destination.
007 * <br><br>
008 * See <a href="https://developers.google.com/maps/documentation/javascript/reference#DistanceMatrixResponseElement">DistanceMatrixResponseElement API Doc</a>
009 */
010 public class DistanceMatrixResponseElement extends JavaScriptObject {
011
012 /**
013 * use newInstance();
014 */
015 protected DistanceMatrixResponseElement() {}
016
017 /**
018 * A single element of a response to a DistanceMatrixService request, which contains the duration and distance from one origin to one destination.
019 */
020 public static final DistanceMatrixResponseElement newInstance() {
021 return JavaScriptObject.createObject().cast();
022 }
023
024 /**
025 * The distance for this origin-destination pairing. This property may be undefined as the distance may be unknown.
026 * @param distance
027 */
028 public final native void setDistance(Distance distance) /*-{
029 this.distance = distance;
030 }-*/;
031
032 /**
033 * The distance for this origin-destination pairing. This property may be undefined as the distance may be unknown.
034 */
035 public final native Distance getDistance() /*-{
036 return this.distance;
037 }-*/;
038
039 /**
040 * The duration for this origin-destination pairing. This property may be undefined as the duration may be unknown.
041 * @param duration
042 */
043 public final native void setDuration(Duration duration) /*-{
044 this.duration = duration;
045 }-*/;
046
047 /**
048 * The duration for this origin-destination pairing. This property may be undefined as the duration may be unknown.
049 */
050 public final native Duration getDuration() /*-{
051 return this.duration;
052 }-*/;
053
054 /**
055 * The status of this particular origin-destination pairing.
056 * @param status
057 */
058 public final void setStatus(DistanceMatrixElementStatus status) {
059 setStatusImpl(status.value());
060 }
061
062 private final native void setStatusImpl(String status) /*-{
063 this.status = status;
064 }-*/;
065
066 /**
067 * The status of this particular origin-destination pairing.
068 */
069 public final DistanceMatrixElementStatus getStatus() {
070 return DistanceMatrixElementStatus.fromValue(getStatusImpl());
071 }
072
073 private final native String getStatusImpl() /*-{
074 return this.status;
075 }-*/;
076
077 }