software.amazon.awssdk.services.snowball.model.ShippingDetails Maven / Gradle / Ivy
Show all versions of snowball Show documentation
/*
* 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.snowball.model;
import java.io.Serializable;
import java.util.Arrays;
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.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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* A job's shipping information, including inbound and outbound tracking numbers and shipping speed options.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ShippingDetails implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField SHIPPING_OPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ShippingOption").getter(getter(ShippingDetails::shippingOptionAsString))
.setter(setter(Builder::shippingOption))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ShippingOption").build()).build();
private static final SdkField INBOUND_SHIPMENT_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("InboundShipment").getter(getter(ShippingDetails::inboundShipment))
.setter(setter(Builder::inboundShipment)).constructor(Shipment::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InboundShipment").build()).build();
private static final SdkField OUTBOUND_SHIPMENT_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("OutboundShipment").getter(getter(ShippingDetails::outboundShipment))
.setter(setter(Builder::outboundShipment)).constructor(Shipment::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutboundShipment").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SHIPPING_OPTION_FIELD,
INBOUND_SHIPMENT_FIELD, OUTBOUND_SHIPMENT_FIELD));
private static final long serialVersionUID = 1L;
private final String shippingOption;
private final Shipment inboundShipment;
private final Shipment outboundShipment;
private ShippingDetails(BuilderImpl builder) {
this.shippingOption = builder.shippingOption;
this.inboundShipment = builder.inboundShipment;
this.outboundShipment = builder.outboundShipment;
}
/**
*
* The shipping speed for a particular job. This speed doesn't dictate how soon you'll get the Snow device from the
* job's creation date. This speed represents how quickly it moves to its destination while in transit. Regional
* shipping speeds are as follows:
*
*
* -
*
* In Australia, you have access to express shipping. Typically, Snow devices shipped express are delivered in about
* a day.
*
*
* -
*
* In the European Union (EU), you have access to express shipping. Typically, Snow devices shipped express are
* delivered in about a day. In addition, most countries in the EU have access to standard shipping, which typically
* takes less than a week, one way.
*
*
* -
*
* In India, Snow devices are delivered in one to seven days.
*
*
* -
*
* In the United States of America (US), you have access to one-day shipping and two-day shipping.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #shippingOption}
* will return {@link ShippingOption#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #shippingOptionAsString}.
*
*
* @return The shipping speed for a particular job. This speed doesn't dictate how soon you'll get the Snow device
* from the job's creation date. This speed represents how quickly it moves to its destination while in
* transit. Regional shipping speeds are as follows:
*
* -
*
* In Australia, you have access to express shipping. Typically, Snow devices shipped express are delivered
* in about a day.
*
*
* -
*
* In the European Union (EU), you have access to express shipping. Typically, Snow devices shipped express
* are delivered in about a day. In addition, most countries in the EU have access to standard shipping,
* which typically takes less than a week, one way.
*
*
* -
*
* In India, Snow devices are delivered in one to seven days.
*
*
* -
*
* In the United States of America (US), you have access to one-day shipping and two-day shipping.
*
*
* @see ShippingOption
*/
public final ShippingOption shippingOption() {
return ShippingOption.fromValue(shippingOption);
}
/**
*
* The shipping speed for a particular job. This speed doesn't dictate how soon you'll get the Snow device from the
* job's creation date. This speed represents how quickly it moves to its destination while in transit. Regional
* shipping speeds are as follows:
*
*
* -
*
* In Australia, you have access to express shipping. Typically, Snow devices shipped express are delivered in about
* a day.
*
*
* -
*
* In the European Union (EU), you have access to express shipping. Typically, Snow devices shipped express are
* delivered in about a day. In addition, most countries in the EU have access to standard shipping, which typically
* takes less than a week, one way.
*
*
* -
*
* In India, Snow devices are delivered in one to seven days.
*
*
* -
*
* In the United States of America (US), you have access to one-day shipping and two-day shipping.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #shippingOption}
* will return {@link ShippingOption#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #shippingOptionAsString}.
*
*
* @return The shipping speed for a particular job. This speed doesn't dictate how soon you'll get the Snow device
* from the job's creation date. This speed represents how quickly it moves to its destination while in
* transit. Regional shipping speeds are as follows:
*
* -
*
* In Australia, you have access to express shipping. Typically, Snow devices shipped express are delivered
* in about a day.
*
*
* -
*
* In the European Union (EU), you have access to express shipping. Typically, Snow devices shipped express
* are delivered in about a day. In addition, most countries in the EU have access to standard shipping,
* which typically takes less than a week, one way.
*
*
* -
*
* In India, Snow devices are delivered in one to seven days.
*
*
* -
*
* In the United States of America (US), you have access to one-day shipping and two-day shipping.
*
*
* @see ShippingOption
*/
public final String shippingOptionAsString() {
return shippingOption;
}
/**
*
* The Status
and TrackingNumber
values for a Snow device being returned to Amazon Web
* Services for a particular job.
*
*
* @return The Status
and TrackingNumber
values for a Snow device being returned to Amazon
* Web Services for a particular job.
*/
public final Shipment inboundShipment() {
return inboundShipment;
}
/**
*
* The Status
and TrackingNumber
values for a Snow device being delivered to the address
* that you specified for a particular job.
*
*
* @return The Status
and TrackingNumber
values for a Snow device being delivered to the
* address that you specified for a particular job.
*/
public final Shipment outboundShipment() {
return outboundShipment;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(shippingOptionAsString());
hashCode = 31 * hashCode + Objects.hashCode(inboundShipment());
hashCode = 31 * hashCode + Objects.hashCode(outboundShipment());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ShippingDetails)) {
return false;
}
ShippingDetails other = (ShippingDetails) obj;
return Objects.equals(shippingOptionAsString(), other.shippingOptionAsString())
&& Objects.equals(inboundShipment(), other.inboundShipment())
&& Objects.equals(outboundShipment(), other.outboundShipment());
}
/**
* 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("ShippingDetails").add("ShippingOption", shippingOptionAsString())
.add("InboundShipment", inboundShipment()).add("OutboundShipment", outboundShipment()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ShippingOption":
return Optional.ofNullable(clazz.cast(shippingOptionAsString()));
case "InboundShipment":
return Optional.ofNullable(clazz.cast(inboundShipment()));
case "OutboundShipment":
return Optional.ofNullable(clazz.cast(outboundShipment()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function