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

software.amazon.awssdk.services.dynamodb.model.PutRequest Maven / Gradle / Ivy

Go to download

A single bundled dependency that includes all service and dependent JARs with third-party libraries relocated to different namespaces.

There is a newer version: 2.25.42
Show newest version
/*
 * Copyright 2013-2018 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.dynamodb.model;

import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.services.dynamodb.transform.PutRequestMarshaller;
import software.amazon.awssdk.utils.CollectionUtils;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Represents a request to perform a PutItem operation on an item. *

*/ @Generated("software.amazon.awssdk:codegen") public final class PutRequest implements StructuredPojo, ToCopyableBuilder { private final Map item; private PutRequest(BuilderImpl builder) { this.item = builder.item; } /** *

* A map of attribute name to attribute values, representing the primary key of an item to be processed by * PutItem. All of the table's primary key attributes must be specified, and their data types must * match those of the table's key schema. If any attributes are present in the item which are part of an index key * schema for the table, their types must match the index key schema. *

*

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

* * @return A map of attribute name to attribute values, representing the primary key of an item to be processed by * PutItem. All of the table's primary key attributes must be specified, and their data types * must match those of the table's key schema. If any attributes are present in the item which are part of * an index key schema for the table, their types must match the index key schema. */ public Map item() { return item; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(item()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof PutRequest)) { return false; } PutRequest other = (PutRequest) obj; return Objects.equals(item(), other.item()); } @Override public String toString() { return ToString.builder("PutRequest").add("Item", item()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Item": return Optional.ofNullable(clazz.cast(item())); default: return Optional.empty(); } } @SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { PutRequestMarshaller.getInstance().marshall(this, protocolMarshaller); } public interface Builder extends CopyableBuilder { /** *

* A map of attribute name to attribute values, representing the primary key of an item to be processed by * PutItem. All of the table's primary key attributes must be specified, and their data types must * match those of the table's key schema. If any attributes are present in the item which are part of an index * key schema for the table, their types must match the index key schema. *

* * @param item * A map of attribute name to attribute values, representing the primary key of an item to be processed * by PutItem. All of the table's primary key attributes must be specified, and their data * types must match those of the table's key schema. If any attributes are present in the item which are * part of an index key schema for the table, their types must match the index key schema. * @return Returns a reference to this object so that method calls can be chained together. */ Builder item(Map item); } static final class BuilderImpl implements Builder { private Map item = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(PutRequest model) { item(model.item); } public final Map getItem() { return item != null ? CollectionUtils.mapValues(item, AttributeValue::toBuilder) : null; } @Override public final Builder item(Map item) { this.item = PutItemInputAttributeMapCopier.copy(item); return this; } public final void setItem(Map item) { this.item = PutItemInputAttributeMapCopier.copyFromBuilder(item); } @Override public PutRequest build() { return new PutRequest(this); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy