Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.outposts.model.OrderSummary Maven / Gradle / Ivy
/*
* 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.outposts.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
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.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* A summary of line items in your order.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class OrderSummary implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField OUTPOST_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OutpostId").getter(getter(OrderSummary::outpostId)).setter(setter(Builder::outpostId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutpostId").build()).build();
private static final SdkField ORDER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OrderId").getter(getter(OrderSummary::orderId)).setter(setter(Builder::orderId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OrderId").build()).build();
private static final SdkField ORDER_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OrderType").getter(getter(OrderSummary::orderTypeAsString)).setter(setter(Builder::orderType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OrderType").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(OrderSummary::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField> LINE_ITEM_COUNTS_BY_STATUS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("LineItemCountsByStatus")
.getter(getter(OrderSummary::lineItemCountsByStatusAsStrings))
.setter(setter(Builder::lineItemCountsByStatusWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LineItemCountsByStatus").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.INTEGER)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField ORDER_SUBMISSION_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("OrderSubmissionDate").getter(getter(OrderSummary::orderSubmissionDate))
.setter(setter(Builder::orderSubmissionDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OrderSubmissionDate").build())
.build();
private static final SdkField ORDER_FULFILLED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("OrderFulfilledDate").getter(getter(OrderSummary::orderFulfilledDate))
.setter(setter(Builder::orderFulfilledDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OrderFulfilledDate").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(OUTPOST_ID_FIELD,
ORDER_ID_FIELD, ORDER_TYPE_FIELD, STATUS_FIELD, LINE_ITEM_COUNTS_BY_STATUS_FIELD, ORDER_SUBMISSION_DATE_FIELD,
ORDER_FULFILLED_DATE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("OutpostId", OUTPOST_ID_FIELD);
put("OrderId", ORDER_ID_FIELD);
put("OrderType", ORDER_TYPE_FIELD);
put("Status", STATUS_FIELD);
put("LineItemCountsByStatus", LINE_ITEM_COUNTS_BY_STATUS_FIELD);
put("OrderSubmissionDate", ORDER_SUBMISSION_DATE_FIELD);
put("OrderFulfilledDate", ORDER_FULFILLED_DATE_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String outpostId;
private final String orderId;
private final String orderType;
private final String status;
private final Map lineItemCountsByStatus;
private final Instant orderSubmissionDate;
private final Instant orderFulfilledDate;
private OrderSummary(BuilderImpl builder) {
this.outpostId = builder.outpostId;
this.orderId = builder.orderId;
this.orderType = builder.orderType;
this.status = builder.status;
this.lineItemCountsByStatus = builder.lineItemCountsByStatus;
this.orderSubmissionDate = builder.orderSubmissionDate;
this.orderFulfilledDate = builder.orderFulfilledDate;
}
/**
*
* The ID of the Outpost.
*
*
* @return The ID of the Outpost.
*/
public final String outpostId() {
return outpostId;
}
/**
*
* The ID of the order.
*
*
* @return The ID of the order.
*/
public final String orderId() {
return orderId;
}
/**
*
* The type of order.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #orderType} will
* return {@link OrderType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #orderTypeAsString}.
*
*
* @return The type of order.
* @see OrderType
*/
public final OrderType orderType() {
return OrderType.fromValue(orderType);
}
/**
*
* The type of order.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #orderType} will
* return {@link OrderType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #orderTypeAsString}.
*
*
* @return The type of order.
* @see OrderType
*/
public final String orderTypeAsString() {
return orderType;
}
/**
*
* The status of the order.
*
*
*
*
* PREPARING
- Order is received and is being prepared.
*
*
*
*
* IN_PROGRESS
- Order is either being built, shipped, or installed. For more information, see the
* LineItem
status.
*
*
*
*
* COMPLETED
- Order is complete.
*
*
*
*
* CANCELLED
- Order is cancelled.
*
*
*
*
* ERROR
- Customer should contact support.
*
*
*
*
*
* The following statuses are deprecated: RECEIVED
, PENDING
, PROCESSING
,
* INSTALLING
, and FULFILLED
.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link OrderStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the order.
*
*
*
* PREPARING
- Order is received and is being prepared.
*
*
*
*
* IN_PROGRESS
- Order is either being built, shipped, or installed. For more information, see
* the LineItem
status.
*
*
*
*
* COMPLETED
- Order is complete.
*
*
*
*
* CANCELLED
- Order is cancelled.
*
*
*
*
* ERROR
- Customer should contact support.
*
*
*
*
*
* The following statuses are deprecated: RECEIVED
, PENDING
,
* PROCESSING
, INSTALLING
, and FULFILLED
.
*
* @see OrderStatus
*/
public final OrderStatus status() {
return OrderStatus.fromValue(status);
}
/**
*
* The status of the order.
*
*
*
*
* PREPARING
- Order is received and is being prepared.
*
*
*
*
* IN_PROGRESS
- Order is either being built, shipped, or installed. For more information, see the
* LineItem
status.
*
*
*
*
* COMPLETED
- Order is complete.
*
*
*
*
* CANCELLED
- Order is cancelled.
*
*
*
*
* ERROR
- Customer should contact support.
*
*
*
*
*
* The following statuses are deprecated: RECEIVED
, PENDING
, PROCESSING
,
* INSTALLING
, and FULFILLED
.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link OrderStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the order.
*
*
*
* PREPARING
- Order is received and is being prepared.
*
*
*
*
* IN_PROGRESS
- Order is either being built, shipped, or installed. For more information, see
* the LineItem
status.
*
*
*
*
* COMPLETED
- Order is complete.
*
*
*
*
* CANCELLED
- Order is cancelled.
*
*
*
*
* ERROR
- Customer should contact support.
*
*
*
*
*
* The following statuses are deprecated: RECEIVED
, PENDING
,
* PROCESSING
, INSTALLING
, and FULFILLED
.
*
* @see OrderStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The status of all line items in the order.
*
*
* 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 #hasLineItemCountsByStatus} method.
*
*
* @return The status of all line items in the order.
*/
public final Map lineItemCountsByStatus() {
return LineItemStatusCountsCopier.copyStringToEnum(lineItemCountsByStatus);
}
/**
* For responses, this returns true if the service returned a value for the LineItemCountsByStatus 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 hasLineItemCountsByStatus() {
return lineItemCountsByStatus != null && !(lineItemCountsByStatus instanceof SdkAutoConstructMap);
}
/**
*
* The status of all line items in the order.
*
*
* 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 #hasLineItemCountsByStatus} method.
*
*
* @return The status of all line items in the order.
*/
public final Map lineItemCountsByStatusAsStrings() {
return lineItemCountsByStatus;
}
/**
*
* The submission date for the order.
*
*
* @return The submission date for the order.
*/
public final Instant orderSubmissionDate() {
return orderSubmissionDate;
}
/**
*
* The fulfilment date for the order.
*
*
* @return The fulfilment date for the order.
*/
public final Instant orderFulfilledDate() {
return orderFulfilledDate;
}
@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(outpostId());
hashCode = 31 * hashCode + Objects.hashCode(orderId());
hashCode = 31 * hashCode + Objects.hashCode(orderTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasLineItemCountsByStatus() ? lineItemCountsByStatusAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(orderSubmissionDate());
hashCode = 31 * hashCode + Objects.hashCode(orderFulfilledDate());
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 OrderSummary)) {
return false;
}
OrderSummary other = (OrderSummary) obj;
return Objects.equals(outpostId(), other.outpostId()) && Objects.equals(orderId(), other.orderId())
&& Objects.equals(orderTypeAsString(), other.orderTypeAsString())
&& Objects.equals(statusAsString(), other.statusAsString())
&& hasLineItemCountsByStatus() == other.hasLineItemCountsByStatus()
&& Objects.equals(lineItemCountsByStatusAsStrings(), other.lineItemCountsByStatusAsStrings())
&& Objects.equals(orderSubmissionDate(), other.orderSubmissionDate())
&& Objects.equals(orderFulfilledDate(), other.orderFulfilledDate());
}
/**
* 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("OrderSummary").add("OutpostId", outpostId()).add("OrderId", orderId())
.add("OrderType", orderTypeAsString()).add("Status", statusAsString())
.add("LineItemCountsByStatus", hasLineItemCountsByStatus() ? lineItemCountsByStatusAsStrings() : null)
.add("OrderSubmissionDate", orderSubmissionDate()).add("OrderFulfilledDate", orderFulfilledDate()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "OutpostId":
return Optional.ofNullable(clazz.cast(outpostId()));
case "OrderId":
return Optional.ofNullable(clazz.cast(orderId()));
case "OrderType":
return Optional.ofNullable(clazz.cast(orderTypeAsString()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "LineItemCountsByStatus":
return Optional.ofNullable(clazz.cast(lineItemCountsByStatusAsStrings()));
case "OrderSubmissionDate":
return Optional.ofNullable(clazz.cast(orderSubmissionDate()));
case "OrderFulfilledDate":
return Optional.ofNullable(clazz.cast(orderFulfilledDate()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function getter(Function g) {
return obj -> g.apply((OrderSummary) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The ID of the Outpost.
*
*
* @param outpostId
* The ID of the Outpost.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder outpostId(String outpostId);
/**
*
* The ID of the order.
*
*
* @param orderId
* The ID of the order.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder orderId(String orderId);
/**
*
* The type of order.
*
*
* @param orderType
* The type of order.
* @see OrderType
* @return Returns a reference to this object so that method calls can be chained together.
* @see OrderType
*/
Builder orderType(String orderType);
/**
*
* The type of order.
*
*
* @param orderType
* The type of order.
* @see OrderType
* @return Returns a reference to this object so that method calls can be chained together.
* @see OrderType
*/
Builder orderType(OrderType orderType);
/**
*
* The status of the order.
*
*
*
*
* PREPARING
- Order is received and is being prepared.
*
*
*
*
* IN_PROGRESS
- Order is either being built, shipped, or installed. For more information, see the
* LineItem
status.
*
*
*
*
* COMPLETED
- Order is complete.
*
*
*
*
* CANCELLED
- Order is cancelled.
*
*
*
*
* ERROR
- Customer should contact support.
*
*
*
*
*
* The following statuses are deprecated: RECEIVED
, PENDING
, PROCESSING
,
* INSTALLING
, and FULFILLED
.
*
*
*
* @param status
* The status of the order.
*
*
*
* PREPARING
- Order is received and is being prepared.
*
*
*
*
* IN_PROGRESS
- Order is either being built, shipped, or installed. For more information,
* see the LineItem
status.
*
*
*
*
* COMPLETED
- Order is complete.
*
*
*
*
* CANCELLED
- Order is cancelled.
*
*
*
*
* ERROR
- Customer should contact support.
*
*
*
*
*
* The following statuses are deprecated: RECEIVED
, PENDING
,
* PROCESSING
, INSTALLING
, and FULFILLED
.
*
* @see OrderStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see OrderStatus
*/
Builder status(String status);
/**
*
* The status of the order.
*
*
*
*
* PREPARING
- Order is received and is being prepared.
*
*
*
*
* IN_PROGRESS
- Order is either being built, shipped, or installed. For more information, see the
* LineItem
status.
*
*
*
*
* COMPLETED
- Order is complete.
*
*
*
*
* CANCELLED
- Order is cancelled.
*
*
*
*
* ERROR
- Customer should contact support.
*
*
*
*
*
* The following statuses are deprecated: RECEIVED
, PENDING
, PROCESSING
,
* INSTALLING
, and FULFILLED
.
*
*
*
* @param status
* The status of the order.
*
*
*
* PREPARING
- Order is received and is being prepared.
*
*
*
*
* IN_PROGRESS
- Order is either being built, shipped, or installed. For more information,
* see the LineItem
status.
*
*
*
*
* COMPLETED
- Order is complete.
*
*
*
*
* CANCELLED
- Order is cancelled.
*
*
*
*
* ERROR
- Customer should contact support.
*
*
*
*
*
* The following statuses are deprecated: RECEIVED
, PENDING
,
* PROCESSING
, INSTALLING
, and FULFILLED
.
*
* @see OrderStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see OrderStatus
*/
Builder status(OrderStatus status);
/**
*
* The status of all line items in the order.
*
*
* @param lineItemCountsByStatus
* The status of all line items in the order.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder lineItemCountsByStatusWithStrings(Map lineItemCountsByStatus);
/**
*
* The status of all line items in the order.
*
*
* @param lineItemCountsByStatus
* The status of all line items in the order.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder lineItemCountsByStatus(Map lineItemCountsByStatus);
/**
*
* The submission date for the order.
*
*
* @param orderSubmissionDate
* The submission date for the order.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder orderSubmissionDate(Instant orderSubmissionDate);
/**
*
* The fulfilment date for the order.
*
*
* @param orderFulfilledDate
* The fulfilment date for the order.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder orderFulfilledDate(Instant orderFulfilledDate);
}
static final class BuilderImpl implements Builder {
private String outpostId;
private String orderId;
private String orderType;
private String status;
private Map lineItemCountsByStatus = DefaultSdkAutoConstructMap.getInstance();
private Instant orderSubmissionDate;
private Instant orderFulfilledDate;
private BuilderImpl() {
}
private BuilderImpl(OrderSummary model) {
outpostId(model.outpostId);
orderId(model.orderId);
orderType(model.orderType);
status(model.status);
lineItemCountsByStatusWithStrings(model.lineItemCountsByStatus);
orderSubmissionDate(model.orderSubmissionDate);
orderFulfilledDate(model.orderFulfilledDate);
}
public final String getOutpostId() {
return outpostId;
}
public final void setOutpostId(String outpostId) {
this.outpostId = outpostId;
}
@Override
public final Builder outpostId(String outpostId) {
this.outpostId = outpostId;
return this;
}
public final String getOrderId() {
return orderId;
}
public final void setOrderId(String orderId) {
this.orderId = orderId;
}
@Override
public final Builder orderId(String orderId) {
this.orderId = orderId;
return this;
}
public final String getOrderType() {
return orderType;
}
public final void setOrderType(String orderType) {
this.orderType = orderType;
}
@Override
public final Builder orderType(String orderType) {
this.orderType = orderType;
return this;
}
@Override
public final Builder orderType(OrderType orderType) {
this.orderType(orderType == null ? null : orderType.toString());
return this;
}
public final String getStatus() {
return status;
}
public final void setStatus(String status) {
this.status = status;
}
@Override
public final Builder status(String status) {
this.status = status;
return this;
}
@Override
public final Builder status(OrderStatus status) {
this.status(status == null ? null : status.toString());
return this;
}
public final Map getLineItemCountsByStatus() {
if (lineItemCountsByStatus instanceof SdkAutoConstructMap) {
return null;
}
return lineItemCountsByStatus;
}
public final void setLineItemCountsByStatus(Map lineItemCountsByStatus) {
this.lineItemCountsByStatus = LineItemStatusCountsCopier.copy(lineItemCountsByStatus);
}
@Override
public final Builder lineItemCountsByStatusWithStrings(Map lineItemCountsByStatus) {
this.lineItemCountsByStatus = LineItemStatusCountsCopier.copy(lineItemCountsByStatus);
return this;
}
@Override
public final Builder lineItemCountsByStatus(Map lineItemCountsByStatus) {
this.lineItemCountsByStatus = LineItemStatusCountsCopier.copyEnumToString(lineItemCountsByStatus);
return this;
}
public final Instant getOrderSubmissionDate() {
return orderSubmissionDate;
}
public final void setOrderSubmissionDate(Instant orderSubmissionDate) {
this.orderSubmissionDate = orderSubmissionDate;
}
@Override
public final Builder orderSubmissionDate(Instant orderSubmissionDate) {
this.orderSubmissionDate = orderSubmissionDate;
return this;
}
public final Instant getOrderFulfilledDate() {
return orderFulfilledDate;
}
public final void setOrderFulfilledDate(Instant orderFulfilledDate) {
this.orderFulfilledDate = orderFulfilledDate;
}
@Override
public final Builder orderFulfilledDate(Instant orderFulfilledDate) {
this.orderFulfilledDate = orderFulfilledDate;
return this;
}
@Override
public OrderSummary build() {
return new OrderSummary(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}