From 4f1829846b3d949779ef902aaf7a185a565b87d1 Mon Sep 17 00:00:00 2001 From: Andrew O'Hara Date: Thu, 29 Feb 2024 21:46:19 -0500 Subject: [PATCH] :art: simplify attribute EnhancedType inference logic --- .../io/andrewohara/dynamokt/ImmutableDataClassAttribute.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/io/andrewohara/dynamokt/ImmutableDataClassAttribute.kt b/src/main/kotlin/io/andrewohara/dynamokt/ImmutableDataClassAttribute.kt index 9a4d9f4..0368d55 100644 --- a/src/main/kotlin/io/andrewohara/dynamokt/ImmutableDataClassAttribute.kt +++ b/src/main/kotlin/io/andrewohara/dynamokt/ImmutableDataClassAttribute.kt @@ -79,11 +79,11 @@ internal fun KProperty1.toImmutableDataCla dataClass: KClass, schemaCache: MetaTableSchemaCache ): ImmutableAttribute { - val customConverter = findAnnotation() + val converter = findAnnotation() ?.converter ?.let { it as KClass> } ?.let { initConverter(it) } - val converter = customConverter ?: AttributeConverterProvider.defaultProvider().converterFor(returnType.toEnhancedType(schemaCache)) + ?: AttributeConverterProvider.defaultProvider().converterFor(returnType.toEnhancedType(schemaCache)) val dynamoName = findAnnotation()?.name?: name @@ -91,7 +91,7 @@ internal fun KProperty1.toImmutableDataCla .builder( EnhancedType.of(dataClass.java), EnhancedType.of(ImmutableDataClassBuilder::class.java), - customConverter?.type() ?: returnType.toEnhancedType(schemaCache) as EnhancedType + converter.type() as EnhancedType ) .name(dynamoName) .getter(::get)