/*
* 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.enhanced.dynamodb.internal.converter.attribute;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NavigableMap;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.function.Supplier;
import software.amazon.awssdk.annotations.Immutable;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.enhanced.dynamodb.AttributeConverter;
import software.amazon.awssdk.enhanced.dynamodb.AttributeValueType;
import software.amazon.awssdk.enhanced.dynamodb.EnhancedType;
import software.amazon.awssdk.enhanced.dynamodb.internal.converter.StringConverter;
import software.amazon.awssdk.enhanced.dynamodb.internal.converter.TypeConvertingVisitor;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
/**
* A converter between a specific {@link Map} type and {@link AttributeValue}.
*
*
* This stores values in DynamoDB as a map from string to attribute value. This uses a configured {@link StringAttributeConverter}
* to convert the map keys to a string, and a configured {@link AttributeConverter} to convert the map values to an attribute
* value.
*
*
* This supports reading maps from DynamoDB. This uses a configured {@link StringAttributeConverter} to convert the map keys, and
* a configured {@link AttributeConverter} to convert the map values.
*
*
* A builder is exposed to allow defining how the map, key and value types are created and converted:
*
* AttributeConverter
*
*
* For frequently-used types, static methods are exposed to reduce the amount of boilerplate involved in creation:
*
* AttributeConverter
*
* @see MapAttributeConverter
*/
@SdkInternalApi
@ThreadSafe
@Immutable
public class MapAttributeConverter> implements AttributeConverter {
private final Delegate delegate;
private MapAttributeConverter(Delegate delegate) {
this.delegate = delegate;
}
public static MapAttributeConverter