All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.location.model.CalculateRouteMatrixRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Location module holds the client classes that are used for communicating with Location.

There is a newer version: 2.29.17
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.location.model;

import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class CalculateRouteMatrixRequest extends LocationRequest implements
        ToCopyableBuilder {
    private static final SdkField CALCULATOR_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("CalculatorName").getter(getter(CalculateRouteMatrixRequest::calculatorName))
            .setter(setter(Builder::calculatorName))
            .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("CalculatorName").build()).build();

    private static final SdkField>> DEPARTURE_POSITIONS_FIELD = SdkField
            .>> builder(MarshallingType.LIST)
            .memberName("DeparturePositions")
            .getter(getter(CalculateRouteMatrixRequest::departurePositions))
            .setter(setter(Builder::departurePositions))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeparturePositions").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField.> builder(MarshallingType.LIST)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build(),
                                                    ListTrait
                                                            .builder()
                                                            .memberLocationName(null)
                                                            .memberFieldInfo(
                                                                    SdkField. builder(MarshallingType.DOUBLE)
                                                                            .traits(LocationTrait.builder()
                                                                                    .location(MarshallLocation.PAYLOAD)
                                                                                    .locationName("member").build()).build())
                                                            .build()).build()).build()).build();

    private static final SdkField>> DESTINATION_POSITIONS_FIELD = SdkField
            .>> builder(MarshallingType.LIST)
            .memberName("DestinationPositions")
            .getter(getter(CalculateRouteMatrixRequest::destinationPositions))
            .setter(setter(Builder::destinationPositions))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DestinationPositions").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField.> builder(MarshallingType.LIST)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build(),
                                                    ListTrait
                                                            .builder()
                                                            .memberLocationName(null)
                                                            .memberFieldInfo(
                                                                    SdkField. builder(MarshallingType.DOUBLE)
                                                                            .traits(LocationTrait.builder()
                                                                                    .location(MarshallLocation.PAYLOAD)
                                                                                    .locationName("member").build()).build())
                                                            .build()).build()).build()).build();

    private static final SdkField TRAVEL_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("TravelMode").getter(getter(CalculateRouteMatrixRequest::travelModeAsString))
            .setter(setter(Builder::travelMode))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TravelMode").build()).build();

    private static final SdkField DEPARTURE_TIME_FIELD = SdkField
            . builder(MarshallingType.INSTANT)
            .memberName("DepartureTime")
            .getter(getter(CalculateRouteMatrixRequest::departureTime))
            .setter(setter(Builder::departureTime))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DepartureTime").build(),
                    TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();

    private static final SdkField DEPART_NOW_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
            .memberName("DepartNow").getter(getter(CalculateRouteMatrixRequest::departNow)).setter(setter(Builder::departNow))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DepartNow").build()).build();

    private static final SdkField DISTANCE_UNIT_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("DistanceUnit").getter(getter(CalculateRouteMatrixRequest::distanceUnitAsString))
            .setter(setter(Builder::distanceUnit))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DistanceUnit").build()).build();

    private static final SdkField CAR_MODE_OPTIONS_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("CarModeOptions")
            .getter(getter(CalculateRouteMatrixRequest::carModeOptions)).setter(setter(Builder::carModeOptions))
            .constructor(CalculateRouteCarModeOptions::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CarModeOptions").build()).build();

    private static final SdkField TRUCK_MODE_OPTIONS_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("TruckModeOptions")
            .getter(getter(CalculateRouteMatrixRequest::truckModeOptions)).setter(setter(Builder::truckModeOptions))
            .constructor(CalculateRouteTruckModeOptions::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TruckModeOptions").build()).build();

    private static final SdkField KEY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Key")
            .getter(getter(CalculateRouteMatrixRequest::key)).setter(setter(Builder::key))
            .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("key").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CALCULATOR_NAME_FIELD,
            DEPARTURE_POSITIONS_FIELD, DESTINATION_POSITIONS_FIELD, TRAVEL_MODE_FIELD, DEPARTURE_TIME_FIELD, DEPART_NOW_FIELD,
            DISTANCE_UNIT_FIELD, CAR_MODE_OPTIONS_FIELD, TRUCK_MODE_OPTIONS_FIELD, KEY_FIELD));

    private final String calculatorName;

    private final List> departurePositions;

    private final List> destinationPositions;

    private final String travelMode;

    private final Instant departureTime;

    private final Boolean departNow;

    private final String distanceUnit;

    private final CalculateRouteCarModeOptions carModeOptions;

    private final CalculateRouteTruckModeOptions truckModeOptions;

    private final String key;

    private CalculateRouteMatrixRequest(BuilderImpl builder) {
        super(builder);
        this.calculatorName = builder.calculatorName;
        this.departurePositions = builder.departurePositions;
        this.destinationPositions = builder.destinationPositions;
        this.travelMode = builder.travelMode;
        this.departureTime = builder.departureTime;
        this.departNow = builder.departNow;
        this.distanceUnit = builder.distanceUnit;
        this.carModeOptions = builder.carModeOptions;
        this.truckModeOptions = builder.truckModeOptions;
        this.key = builder.key;
    }

    /**
     * 

* The name of the route calculator resource that you want to use to calculate the route matrix. *

* * @return The name of the route calculator resource that you want to use to calculate the route matrix. */ public final String calculatorName() { return calculatorName; } /** * For responses, this returns true if the service returned a value for the DeparturePositions property. This DOES * NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasDeparturePositions() { return departurePositions != null && !(departurePositions instanceof SdkAutoConstructList); } /** *

* The list of departure (origin) positions for the route matrix. An array of points, each of which is itself a * 2-value array defined in WGS 84 format: * [longitude, latitude]. For example, [-123.115, 49.285]. *

* *

* Depending on the data provider selected in the route calculator resource there may be additional restrictions on * the inputs you can choose. See Position restrictions in the Amazon Location Service Developer Guide. *

*
*

* For route calculators that use Esri as the data provider, if you specify a departure that's not located on a * road, Amazon Location moves the position to * the nearest road. The snapped value is available in the result in SnappedDeparturePositions. *

*
*

* Valid Values: [-180 to 180,-90 to 90] *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasDeparturePositions} method. *

* * @return The list of departure (origin) positions for the route matrix. An array of points, each of which is * itself a 2-value array defined in WGS 84 * format: [longitude, latitude]. For example, [-123.115, 49.285].

*

* Depending on the data provider selected in the route calculator resource there may be additional * restrictions on the inputs you can choose. See Position restrictions in the Amazon Location Service Developer Guide. *

*
*

* For route calculators that use Esri as the data provider, if you specify a departure that's not located * on a road, Amazon Location moves the * position to the nearest road. The snapped value is available in the result in * SnappedDeparturePositions. *

*
*

* Valid Values: [-180 to 180,-90 to 90] */ public final List> departurePositions() { return departurePositions; } /** * For responses, this returns true if the service returned a value for the DestinationPositions property. This DOES * NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasDestinationPositions() { return destinationPositions != null && !(destinationPositions instanceof SdkAutoConstructList); } /** *

* The list of destination positions for the route matrix. An array of points, each of which is itself a 2-value * array defined in WGS 84 format: * [longitude, latitude]. For example, [-122.339, 47.615] *

* *

* Depending on the data provider selected in the route calculator resource there may be additional restrictions on * the inputs you can choose. See Position restrictions in the Amazon Location Service Developer Guide. *

*
*

* For route calculators that use Esri as the data provider, if you specify a destination that's not located on a * road, Amazon Location moves the position to * the nearest road. The snapped value is available in the result in SnappedDestinationPositions. *

*
*

* Valid Values: [-180 to 180,-90 to 90] *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasDestinationPositions} method. *

* * @return The list of destination positions for the route matrix. An array of points, each of which is itself a * 2-value array defined in WGS 84 format: * [longitude, latitude]. For example, [-122.339, 47.615]

*

* Depending on the data provider selected in the route calculator resource there may be additional * restrictions on the inputs you can choose. See Position restrictions in the Amazon Location Service Developer Guide. *

*
*

* For route calculators that use Esri as the data provider, if you specify a destination that's not located * on a road, Amazon Location moves the * position to the nearest road. The snapped value is available in the result in * SnappedDestinationPositions. *

*
*

* Valid Values: [-180 to 180,-90 to 90] */ public final List> destinationPositions() { return destinationPositions; } /** *

* Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and road * compatibility. *

*

* The TravelMode you specify also determines how you specify route preferences: *

*
    *
  • *

    * If traveling by Car use the CarModeOptions parameter. *

    *
  • *
  • *

    * If traveling by Truck use the TruckModeOptions parameter. *

    *
  • *
* *

* Bicycle or Motorcycle are only valid when using Grab as a data provider, * and only within Southeast Asia. *

*

* Truck is not available for Grab. *

*

* For more information about using Grab as a data provider, see GrabMaps in the Amazon * Location Service Developer Guide. *

*
*

* Default Value: Car *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #travelMode} will * return {@link TravelMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #travelModeAsString}. *

* * @return Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and road * compatibility.

*

* The TravelMode you specify also determines how you specify route preferences: *

*
    *
  • *

    * If traveling by Car use the CarModeOptions parameter. *

    *
  • *
  • *

    * If traveling by Truck use the TruckModeOptions parameter. *

    *
  • *
* *

* Bicycle or Motorcycle are only valid when using Grab as a data * provider, and only within Southeast Asia. *

*

* Truck is not available for Grab. *

*

* For more information about using Grab as a data provider, see GrabMaps in the Amazon * Location Service Developer Guide. *

*
*

* Default Value: Car * @see TravelMode */ public final TravelMode travelMode() { return TravelMode.fromValue(travelMode); } /** *

* Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and road * compatibility. *

*

* The TravelMode you specify also determines how you specify route preferences: *

*
    *
  • *

    * If traveling by Car use the CarModeOptions parameter. *

    *
  • *
  • *

    * If traveling by Truck use the TruckModeOptions parameter. *

    *
  • *
* *

* Bicycle or Motorcycle are only valid when using Grab as a data provider, * and only within Southeast Asia. *

*

* Truck is not available for Grab. *

*

* For more information about using Grab as a data provider, see GrabMaps in the Amazon * Location Service Developer Guide. *

*
*

* Default Value: Car *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #travelMode} will * return {@link TravelMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #travelModeAsString}. *

* * @return Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and road * compatibility.

*

* The TravelMode you specify also determines how you specify route preferences: *

*
    *
  • *

    * If traveling by Car use the CarModeOptions parameter. *

    *
  • *
  • *

    * If traveling by Truck use the TruckModeOptions parameter. *

    *
  • *
* *

* Bicycle or Motorcycle are only valid when using Grab as a data * provider, and only within Southeast Asia. *

*

* Truck is not available for Grab. *

*

* For more information about using Grab as a data provider, see GrabMaps in the Amazon * Location Service Developer Guide. *

*
*

* Default Value: Car * @see TravelMode */ public final String travelModeAsString() { return travelMode; } /** *

* Specifies the desired time of departure. Uses the given time to calculate the route matrix. You can't set both * DepartureTime and DepartNow. If neither is set, the best time of day to travel with the * best traffic conditions is used to calculate the route matrix. *

* *

* Setting a departure time in the past returns a 400 ValidationException error. *

*
*
    *
  • *

    * In ISO 8601 format: * YYYY-MM-DDThh:mm:ss.sssZ. For example, 2020–07-2T12:15:20.000Z+01:00 *

    *
  • *
* * @return Specifies the desired time of departure. Uses the given time to calculate the route matrix. You can't set * both DepartureTime and DepartNow. If neither is set, the best time of day to * travel with the best traffic conditions is used to calculate the route matrix.

*

* Setting a departure time in the past returns a 400 ValidationException error. *

*
*
    *
  • *

    * In ISO 8601 format: * YYYY-MM-DDThh:mm:ss.sssZ. For example, 2020–07-2T12:15:20.000Z+01:00 *

    *
  • */ public final Instant departureTime() { return departureTime; } /** *

    * Sets the time of departure as the current time. Uses the current time to calculate the route matrix. You can't * set both DepartureTime and DepartNow. If neither is set, the best time of day to travel * with the best traffic conditions is used to calculate the route matrix. *

    *

    * Default Value: false *

    *

    * Valid Values: false | true *

    * * @return Sets the time of departure as the current time. Uses the current time to calculate the route matrix. You * can't set both DepartureTime and DepartNow. If neither is set, the best time of * day to travel with the best traffic conditions is used to calculate the route matrix.

    *

    * Default Value: false *

    *

    * Valid Values: false | true */ public final Boolean departNow() { return departNow; } /** *

    * Set the unit system to specify the distance. *

    *

    * Default Value: Kilometers *

    *

    * If the service returns an enum value that is not available in the current SDK version, {@link #distanceUnit} will * return {@link DistanceUnit#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #distanceUnitAsString}. *

    * * @return Set the unit system to specify the distance.

    *

    * Default Value: Kilometers * @see DistanceUnit */ public final DistanceUnit distanceUnit() { return DistanceUnit.fromValue(distanceUnit); } /** *

    * Set the unit system to specify the distance. *

    *

    * Default Value: Kilometers *

    *

    * If the service returns an enum value that is not available in the current SDK version, {@link #distanceUnit} will * return {@link DistanceUnit#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #distanceUnitAsString}. *

    * * @return Set the unit system to specify the distance.

    *

    * Default Value: Kilometers * @see DistanceUnit */ public final String distanceUnitAsString() { return distanceUnit; } /** *

    * Specifies route preferences when traveling by Car, such as avoiding routes that use ferries or * tolls. *

    *

    * Requirements: TravelMode must be specified as Car. *

    * * @return Specifies route preferences when traveling by Car, such as avoiding routes that use ferries * or tolls.

    *

    * Requirements: TravelMode must be specified as Car. */ public final CalculateRouteCarModeOptions carModeOptions() { return carModeOptions; } /** *

    * Specifies route preferences when traveling by Truck, such as avoiding routes that use ferries or * tolls, and truck specifications to consider when choosing an optimal road. *

    *

    * Requirements: TravelMode must be specified as Truck. *

    * * @return Specifies route preferences when traveling by Truck, such as avoiding routes that use * ferries or tolls, and truck specifications to consider when choosing an optimal road.

    *

    * Requirements: TravelMode must be specified as Truck. */ public final CalculateRouteTruckModeOptions truckModeOptions() { return truckModeOptions; } /** *

    * The optional API key * to authorize the request. *

    * * @return The optional API * key to authorize the request. */ public final String key() { return key; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(calculatorName()); hashCode = 31 * hashCode + Objects.hashCode(hasDeparturePositions() ? departurePositions() : null); hashCode = 31 * hashCode + Objects.hashCode(hasDestinationPositions() ? destinationPositions() : null); hashCode = 31 * hashCode + Objects.hashCode(travelModeAsString()); hashCode = 31 * hashCode + Objects.hashCode(departureTime()); hashCode = 31 * hashCode + Objects.hashCode(departNow()); hashCode = 31 * hashCode + Objects.hashCode(distanceUnitAsString()); hashCode = 31 * hashCode + Objects.hashCode(carModeOptions()); hashCode = 31 * hashCode + Objects.hashCode(truckModeOptions()); hashCode = 31 * hashCode + Objects.hashCode(key()); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof CalculateRouteMatrixRequest)) { return false; } CalculateRouteMatrixRequest other = (CalculateRouteMatrixRequest) obj; return Objects.equals(calculatorName(), other.calculatorName()) && hasDeparturePositions() == other.hasDeparturePositions() && Objects.equals(departurePositions(), other.departurePositions()) && hasDestinationPositions() == other.hasDestinationPositions() && Objects.equals(destinationPositions(), other.destinationPositions()) && Objects.equals(travelModeAsString(), other.travelModeAsString()) && Objects.equals(departureTime(), other.departureTime()) && Objects.equals(departNow(), other.departNow()) && Objects.equals(distanceUnitAsString(), other.distanceUnitAsString()) && Objects.equals(carModeOptions(), other.carModeOptions()) && Objects.equals(truckModeOptions(), other.truckModeOptions()) && Objects.equals(key(), other.key()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("CalculateRouteMatrixRequest").add("CalculatorName", calculatorName()) .add("DeparturePositions", departurePositions() == null ? null : "*** Sensitive Data Redacted ***") .add("DestinationPositions", destinationPositions() == null ? null : "*** Sensitive Data Redacted ***") .add("TravelMode", travelModeAsString()).add("DepartureTime", departureTime()).add("DepartNow", departNow()) .add("DistanceUnit", distanceUnitAsString()).add("CarModeOptions", carModeOptions()) .add("TruckModeOptions", truckModeOptions()).add("Key", key() == null ? null : "*** Sensitive Data Redacted ***") .build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "CalculatorName": return Optional.ofNullable(clazz.cast(calculatorName())); case "DeparturePositions": return Optional.ofNullable(clazz.cast(departurePositions())); case "DestinationPositions": return Optional.ofNullable(clazz.cast(destinationPositions())); case "TravelMode": return Optional.ofNullable(clazz.cast(travelModeAsString())); case "DepartureTime": return Optional.ofNullable(clazz.cast(departureTime())); case "DepartNow": return Optional.ofNullable(clazz.cast(departNow())); case "DistanceUnit": return Optional.ofNullable(clazz.cast(distanceUnitAsString())); case "CarModeOptions": return Optional.ofNullable(clazz.cast(carModeOptions())); case "TruckModeOptions": return Optional.ofNullable(clazz.cast(truckModeOptions())); case "Key": return Optional.ofNullable(clazz.cast(key())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CalculateRouteMatrixRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends LocationRequest.Builder, SdkPojo, CopyableBuilder { /** *

    * The name of the route calculator resource that you want to use to calculate the route matrix. *

    * * @param calculatorName * The name of the route calculator resource that you want to use to calculate the route matrix. * @return Returns a reference to this object so that method calls can be chained together. */ Builder calculatorName(String calculatorName); /** *

    * The list of departure (origin) positions for the route matrix. An array of points, each of which is itself a * 2-value array defined in WGS 84 format: * [longitude, latitude]. For example, [-123.115, 49.285]. *

    * *

    * Depending on the data provider selected in the route calculator resource there may be additional restrictions * on the inputs you can choose. See Position restrictions in the Amazon Location Service Developer Guide. *

    *
    *

    * For route calculators that use Esri as the data provider, if you specify a departure that's not located on a * road, Amazon Location moves the * position to the nearest road. The snapped value is available in the result in * SnappedDeparturePositions. *

    *
    *

    * Valid Values: [-180 to 180,-90 to 90] *

    * * @param departurePositions * The list of departure (origin) positions for the route matrix. An array of points, each of which is * itself a 2-value array defined in WGS * 84 format: [longitude, latitude]. For example, [-123.115, 49.285].

    * *

    * Depending on the data provider selected in the route calculator resource there may be additional * restrictions on the inputs you can choose. See Position restrictions in the Amazon Location Service Developer Guide. *

    *
    *

    * For route calculators that use Esri as the data provider, if you specify a departure that's not * located on a road, Amazon Location moves the * position to the nearest road. The snapped value is available in the result in * SnappedDeparturePositions. *

    *
    *

    * Valid Values: [-180 to 180,-90 to 90] * @return Returns a reference to this object so that method calls can be chained together. */ Builder departurePositions(Collection> departurePositions); /** *

    * The list of departure (origin) positions for the route matrix. An array of points, each of which is itself a * 2-value array defined in WGS 84 format: * [longitude, latitude]. For example, [-123.115, 49.285]. *

    * *

    * Depending on the data provider selected in the route calculator resource there may be additional restrictions * on the inputs you can choose. See Position restrictions in the Amazon Location Service Developer Guide. *

    *
    *

    * For route calculators that use Esri as the data provider, if you specify a departure that's not located on a * road, Amazon Location moves the * position to the nearest road. The snapped value is available in the result in * SnappedDeparturePositions. *

    *
    *

    * Valid Values: [-180 to 180,-90 to 90] *

    * * @param departurePositions * The list of departure (origin) positions for the route matrix. An array of points, each of which is * itself a 2-value array defined in WGS * 84 format: [longitude, latitude]. For example, [-123.115, 49.285].

    * *

    * Depending on the data provider selected in the route calculator resource there may be additional * restrictions on the inputs you can choose. See Position restrictions in the Amazon Location Service Developer Guide. *

    *
    *

    * For route calculators that use Esri as the data provider, if you specify a departure that's not * located on a road, Amazon Location moves the * position to the nearest road. The snapped value is available in the result in * SnappedDeparturePositions. *

    *
    *

    * Valid Values: [-180 to 180,-90 to 90] * @return Returns a reference to this object so that method calls can be chained together. */ Builder departurePositions(Collection... departurePositions); /** *

    * The list of destination positions for the route matrix. An array of points, each of which is itself a 2-value * array defined in WGS 84 format: * [longitude, latitude]. For example, [-122.339, 47.615] *

    * *

    * Depending on the data provider selected in the route calculator resource there may be additional restrictions * on the inputs you can choose. See Position restrictions in the Amazon Location Service Developer Guide. *

    *
    *

    * For route calculators that use Esri as the data provider, if you specify a destination that's not located on * a road, Amazon Location moves the * position to the nearest road. The snapped value is available in the result in * SnappedDestinationPositions. *

    *
    *

    * Valid Values: [-180 to 180,-90 to 90] *

    * * @param destinationPositions * The list of destination positions for the route matrix. An array of points, each of which is itself a * 2-value array defined in WGS 84 * format: [longitude, latitude]. For example, [-122.339, 47.615]

    * *

    * Depending on the data provider selected in the route calculator resource there may be additional * restrictions on the inputs you can choose. See Position restrictions in the Amazon Location Service Developer Guide. *

    *
    *

    * For route calculators that use Esri as the data provider, if you specify a destination that's not * located on a road, Amazon Location moves the * position to the nearest road. The snapped value is available in the result in * SnappedDestinationPositions. *

    *
    *

    * Valid Values: [-180 to 180,-90 to 90] * @return Returns a reference to this object so that method calls can be chained together. */ Builder destinationPositions(Collection> destinationPositions); /** *

    * The list of destination positions for the route matrix. An array of points, each of which is itself a 2-value * array defined in WGS 84 format: * [longitude, latitude]. For example, [-122.339, 47.615] *

    * *

    * Depending on the data provider selected in the route calculator resource there may be additional restrictions * on the inputs you can choose. See Position restrictions in the Amazon Location Service Developer Guide. *

    *
    *

    * For route calculators that use Esri as the data provider, if you specify a destination that's not located on * a road, Amazon Location moves the * position to the nearest road. The snapped value is available in the result in * SnappedDestinationPositions. *

    *
    *

    * Valid Values: [-180 to 180,-90 to 90] *

    * * @param destinationPositions * The list of destination positions for the route matrix. An array of points, each of which is itself a * 2-value array defined in WGS 84 * format: [longitude, latitude]. For example, [-122.339, 47.615]

    * *

    * Depending on the data provider selected in the route calculator resource there may be additional * restrictions on the inputs you can choose. See Position restrictions in the Amazon Location Service Developer Guide. *

    *
    *

    * For route calculators that use Esri as the data provider, if you specify a destination that's not * located on a road, Amazon Location moves the * position to the nearest road. The snapped value is available in the result in * SnappedDestinationPositions. *

    *
    *

    * Valid Values: [-180 to 180,-90 to 90] * @return Returns a reference to this object so that method calls can be chained together. */ Builder destinationPositions(Collection... destinationPositions); /** *

    * Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and road * compatibility. *

    *

    * The TravelMode you specify also determines how you specify route preferences: *

    *
      *
    • *

      * If traveling by Car use the CarModeOptions parameter. *

      *
    • *
    • *

      * If traveling by Truck use the TruckModeOptions parameter. *

      *
    • *
    * *

    * Bicycle or Motorcycle are only valid when using Grab as a data * provider, and only within Southeast Asia. *

    *

    * Truck is not available for Grab. *

    *

    * For more information about using Grab as a data provider, see GrabMaps in the Amazon * Location Service Developer Guide. *

    *
    *

    * Default Value: Car *

    * * @param travelMode * Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and * road compatibility.

    *

    * The TravelMode you specify also determines how you specify route preferences: *

    *
      *
    • *

      * If traveling by Car use the CarModeOptions parameter. *

      *
    • *
    • *

      * If traveling by Truck use the TruckModeOptions parameter. *

      *
    • *
    * *

    * Bicycle or Motorcycle are only valid when using Grab as a data * provider, and only within Southeast Asia. *

    *

    * Truck is not available for Grab. *

    *

    * For more information about using Grab as a data provider, see GrabMaps in the * Amazon Location Service Developer Guide. *

    *
    *

    * Default Value: Car * @see TravelMode * @return Returns a reference to this object so that method calls can be chained together. * @see TravelMode */ Builder travelMode(String travelMode); /** *

    * Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and road * compatibility. *

    *

    * The TravelMode you specify also determines how you specify route preferences: *

    *
      *
    • *

      * If traveling by Car use the CarModeOptions parameter. *

      *
    • *
    • *

      * If traveling by Truck use the TruckModeOptions parameter. *

      *
    • *
    * *

    * Bicycle or Motorcycle are only valid when using Grab as a data * provider, and only within Southeast Asia. *

    *

    * Truck is not available for Grab. *

    *

    * For more information about using Grab as a data provider, see GrabMaps in the Amazon * Location Service Developer Guide. *

    *
    *

    * Default Value: Car *

    * * @param travelMode * Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and * road compatibility.

    *

    * The TravelMode you specify also determines how you specify route preferences: *

    *
      *
    • *

      * If traveling by Car use the CarModeOptions parameter. *

      *
    • *
    • *

      * If traveling by Truck use the TruckModeOptions parameter. *

      *
    • *
    * *

    * Bicycle or Motorcycle are only valid when using Grab as a data * provider, and only within Southeast Asia. *

    *

    * Truck is not available for Grab. *

    *

    * For more information about using Grab as a data provider, see GrabMaps in the * Amazon Location Service Developer Guide. *

    *
    *

    * Default Value: Car * @see TravelMode * @return Returns a reference to this object so that method calls can be chained together. * @see TravelMode */ Builder travelMode(TravelMode travelMode); /** *

    * Specifies the desired time of departure. Uses the given time to calculate the route matrix. You can't set * both DepartureTime and DepartNow. If neither is set, the best time of day to travel * with the best traffic conditions is used to calculate the route matrix. *

    * *

    * Setting a departure time in the past returns a 400 ValidationException error. *

    *
    *
      *
    • *

      * In ISO 8601 format: * YYYY-MM-DDThh:mm:ss.sssZ. For example, 2020–07-2T12:15:20.000Z+01:00 *

      *
    • *
    * * @param departureTime * Specifies the desired time of departure. Uses the given time to calculate the route matrix. You can't * set both DepartureTime and DepartNow. If neither is set, the best time of * day to travel with the best traffic conditions is used to calculate the route matrix.

    *

    * Setting a departure time in the past returns a 400 ValidationException error. *

    *
    *
      *
    • *

      * In ISO 8601 format: * YYYY-MM-DDThh:mm:ss.sssZ. For example, 2020–07-2T12:15:20.000Z+01:00 *

      *
    • * @return Returns a reference to this object so that method calls can be chained together. */ Builder departureTime(Instant departureTime); /** *

      * Sets the time of departure as the current time. Uses the current time to calculate the route matrix. You * can't set both DepartureTime and DepartNow. If neither is set, the best time of day * to travel with the best traffic conditions is used to calculate the route matrix. *

      *

      * Default Value: false *

      *

      * Valid Values: false | true *

      * * @param departNow * Sets the time of departure as the current time. Uses the current time to calculate the route matrix. * You can't set both DepartureTime and DepartNow. If neither is set, the best * time of day to travel with the best traffic conditions is used to calculate the route matrix.

      *

      * Default Value: false *

      *

      * Valid Values: false | true * @return Returns a reference to this object so that method calls can be chained together. */ Builder departNow(Boolean departNow); /** *

      * Set the unit system to specify the distance. *

      *

      * Default Value: Kilometers *

      * * @param distanceUnit * Set the unit system to specify the distance.

      *

      * Default Value: Kilometers * @see DistanceUnit * @return Returns a reference to this object so that method calls can be chained together. * @see DistanceUnit */ Builder distanceUnit(String distanceUnit); /** *

      * Set the unit system to specify the distance. *

      *

      * Default Value: Kilometers *

      * * @param distanceUnit * Set the unit system to specify the distance.

      *

      * Default Value: Kilometers * @see DistanceUnit * @return Returns a reference to this object so that method calls can be chained together. * @see DistanceUnit */ Builder distanceUnit(DistanceUnit distanceUnit); /** *

      * Specifies route preferences when traveling by Car, such as avoiding routes that use ferries or * tolls. *

      *

      * Requirements: TravelMode must be specified as Car. *

      * * @param carModeOptions * Specifies route preferences when traveling by Car, such as avoiding routes that use * ferries or tolls.

      *

      * Requirements: TravelMode must be specified as Car. * @return Returns a reference to this object so that method calls can be chained together. */ Builder carModeOptions(CalculateRouteCarModeOptions carModeOptions); /** *

      * Specifies route preferences when traveling by Car, such as avoiding routes that use ferries or * tolls. *

      *

      * Requirements: TravelMode must be specified as Car. *

      * This is a convenience method that creates an instance of the {@link CalculateRouteCarModeOptions.Builder} * avoiding the need to create one manually via {@link CalculateRouteCarModeOptions#builder()}. * *

      * When the {@link Consumer} completes, {@link CalculateRouteCarModeOptions.Builder#build()} is called * immediately and its result is passed to {@link #carModeOptions(CalculateRouteCarModeOptions)}. * * @param carModeOptions * a consumer that will call methods on {@link CalculateRouteCarModeOptions.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #carModeOptions(CalculateRouteCarModeOptions) */ default Builder carModeOptions(Consumer carModeOptions) { return carModeOptions(CalculateRouteCarModeOptions.builder().applyMutation(carModeOptions).build()); } /** *

      * Specifies route preferences when traveling by Truck, such as avoiding routes that use ferries or * tolls, and truck specifications to consider when choosing an optimal road. *

      *

      * Requirements: TravelMode must be specified as Truck. *

      * * @param truckModeOptions * Specifies route preferences when traveling by Truck, such as avoiding routes that use * ferries or tolls, and truck specifications to consider when choosing an optimal road.

      *

      * Requirements: TravelMode must be specified as Truck. * @return Returns a reference to this object so that method calls can be chained together. */ Builder truckModeOptions(CalculateRouteTruckModeOptions truckModeOptions); /** *

      * Specifies route preferences when traveling by Truck, such as avoiding routes that use ferries or * tolls, and truck specifications to consider when choosing an optimal road. *

      *

      * Requirements: TravelMode must be specified as Truck. *

      * This is a convenience method that creates an instance of the {@link CalculateRouteTruckModeOptions.Builder} * avoiding the need to create one manually via {@link CalculateRouteTruckModeOptions#builder()}. * *

      * When the {@link Consumer} completes, {@link CalculateRouteTruckModeOptions.Builder#build()} is called * immediately and its result is passed to {@link #truckModeOptions(CalculateRouteTruckModeOptions)}. * * @param truckModeOptions * a consumer that will call methods on {@link CalculateRouteTruckModeOptions.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #truckModeOptions(CalculateRouteTruckModeOptions) */ default Builder truckModeOptions(Consumer truckModeOptions) { return truckModeOptions(CalculateRouteTruckModeOptions.builder().applyMutation(truckModeOptions).build()); } /** *

      * The optional API * key to authorize the request. *

      * * @param key * The optional API key to * authorize the request. * @return Returns a reference to this object so that method calls can be chained together. */ Builder key(String key); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends LocationRequest.BuilderImpl implements Builder { private String calculatorName; private List> departurePositions = DefaultSdkAutoConstructList.getInstance(); private List> destinationPositions = DefaultSdkAutoConstructList.getInstance(); private String travelMode; private Instant departureTime; private Boolean departNow; private String distanceUnit; private CalculateRouteCarModeOptions carModeOptions; private CalculateRouteTruckModeOptions truckModeOptions; private String key; private BuilderImpl() { } private BuilderImpl(CalculateRouteMatrixRequest model) { super(model); calculatorName(model.calculatorName); departurePositions(model.departurePositions); destinationPositions(model.destinationPositions); travelMode(model.travelMode); departureTime(model.departureTime); departNow(model.departNow); distanceUnit(model.distanceUnit); carModeOptions(model.carModeOptions); truckModeOptions(model.truckModeOptions); key(model.key); } public final String getCalculatorName() { return calculatorName; } public final void setCalculatorName(String calculatorName) { this.calculatorName = calculatorName; } @Override public final Builder calculatorName(String calculatorName) { this.calculatorName = calculatorName; return this; } public final Collection> getDeparturePositions() { if (departurePositions instanceof SdkAutoConstructList) { return null; } return departurePositions; } public final void setDeparturePositions(Collection> departurePositions) { this.departurePositions = CalculateRouteMatrixRequestDeparturePositionsListCopier.copy(departurePositions); } @Override public final Builder departurePositions(Collection> departurePositions) { this.departurePositions = CalculateRouteMatrixRequestDeparturePositionsListCopier.copy(departurePositions); return this; } @Override @SafeVarargs public final Builder departurePositions(Collection... departurePositions) { departurePositions(Arrays.asList(departurePositions)); return this; } public final Collection> getDestinationPositions() { if (destinationPositions instanceof SdkAutoConstructList) { return null; } return destinationPositions; } public final void setDestinationPositions(Collection> destinationPositions) { this.destinationPositions = CalculateRouteMatrixRequestDestinationPositionsListCopier.copy(destinationPositions); } @Override public final Builder destinationPositions(Collection> destinationPositions) { this.destinationPositions = CalculateRouteMatrixRequestDestinationPositionsListCopier.copy(destinationPositions); return this; } @Override @SafeVarargs public final Builder destinationPositions(Collection... destinationPositions) { destinationPositions(Arrays.asList(destinationPositions)); return this; } public final String getTravelMode() { return travelMode; } public final void setTravelMode(String travelMode) { this.travelMode = travelMode; } @Override public final Builder travelMode(String travelMode) { this.travelMode = travelMode; return this; } @Override public final Builder travelMode(TravelMode travelMode) { this.travelMode(travelMode == null ? null : travelMode.toString()); return this; } public final Instant getDepartureTime() { return departureTime; } public final void setDepartureTime(Instant departureTime) { this.departureTime = departureTime; } @Override public final Builder departureTime(Instant departureTime) { this.departureTime = departureTime; return this; } public final Boolean getDepartNow() { return departNow; } public final void setDepartNow(Boolean departNow) { this.departNow = departNow; } @Override public final Builder departNow(Boolean departNow) { this.departNow = departNow; return this; } public final String getDistanceUnit() { return distanceUnit; } public final void setDistanceUnit(String distanceUnit) { this.distanceUnit = distanceUnit; } @Override public final Builder distanceUnit(String distanceUnit) { this.distanceUnit = distanceUnit; return this; } @Override public final Builder distanceUnit(DistanceUnit distanceUnit) { this.distanceUnit(distanceUnit == null ? null : distanceUnit.toString()); return this; } public final CalculateRouteCarModeOptions.Builder getCarModeOptions() { return carModeOptions != null ? carModeOptions.toBuilder() : null; } public final void setCarModeOptions(CalculateRouteCarModeOptions.BuilderImpl carModeOptions) { this.carModeOptions = carModeOptions != null ? carModeOptions.build() : null; } @Override public final Builder carModeOptions(CalculateRouteCarModeOptions carModeOptions) { this.carModeOptions = carModeOptions; return this; } public final CalculateRouteTruckModeOptions.Builder getTruckModeOptions() { return truckModeOptions != null ? truckModeOptions.toBuilder() : null; } public final void setTruckModeOptions(CalculateRouteTruckModeOptions.BuilderImpl truckModeOptions) { this.truckModeOptions = truckModeOptions != null ? truckModeOptions.build() : null; } @Override public final Builder truckModeOptions(CalculateRouteTruckModeOptions truckModeOptions) { this.truckModeOptions = truckModeOptions; return this; } public final String getKey() { return key; } public final void setKey(String key) { this.key = key; } @Override public final Builder key(String key) { this.key = key; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public CalculateRouteMatrixRequest build() { return new CalculateRouteMatrixRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy