1 /* 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"). 5 * You may not use this file except in compliance with the License. 6 * A copy of the License is located at 7 * 8 * http://aws.amazon.com/apache2.0 9 * 10 * or in the "license" file accompanying this file. This file is distributed 11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 * express or implied. See the License for the specific language governing 13 * permissions and limitations under the License. 14 */ 15 16 package software.amazon.awssdk.enhanced.dynamodb; 17 18 import software.amazon.awssdk.annotations.SdkPublicApi; 19 import software.amazon.awssdk.annotations.ThreadSafe; 20 import software.amazon.awssdk.enhanced.dynamodb.internal.converter.ConverterProviderResolver; 21 import software.amazon.awssdk.services.dynamodb.model.AttributeValue; 22 23 /** 24 * Interface for determining the {@link AttributeConverter} to use for 25 * converting a given {@link EnhancedType}. 26 */ 27 @SdkPublicApi 28 @ThreadSafe 29 public interface AttributeConverterProvider { 30 31 /** 32 * Finds a {@link AttributeConverter} for converting an object with a type 33 * specified by a {@link EnhancedType} to a {@link AttributeValue} and back. 34 * 35 * @param enhancedType The type of the object to be converted 36 * @return {@link AttributeConverter} for converting the given type. 37 */ converterFor(EnhancedType<T> enhancedType)38 <T> AttributeConverter<T> converterFor(EnhancedType<T> enhancedType); 39 40 /** 41 * Returns a default implementation of AttributeConverterProvider with all 42 * standard Java type converters included. 43 */ defaultProvider()44 static AttributeConverterProvider defaultProvider() { 45 return ConverterProviderResolver.defaultConverterProvider(); 46 } 47 } 48