Skip to content

Commit eed3945

Browse files
committed
Changed implementation for list of nested objects for timestamp extension and added tests
1 parent e719423 commit eed3945

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/extensions/AutoGeneratedTimestampRecordExtension.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public WriteModification beforeWrite(DynamoDbExtensionContext.BeforeWrite contex
151151
updatedItems.put(key, AttributeValue.builder().m(processed).build());
152152
}
153153
} else if (value.hasL() && !value.l().isEmpty() && value.l().get(0).hasM()) {
154-
TableSchema<?> elementListSchema = getTableSchemaForElementList(context.tableSchema(), key);
154+
TableSchema<?> elementListSchema = getTableSchemaForListElement(context.tableSchema(), key);
155155

156156
List<AttributeValue> updatedList = value.l().stream()
157157
.map(listItem -> listItem.hasM() ?
@@ -185,11 +185,11 @@ public WriteModification beforeWrite(DynamoDbExtensionContext.BeforeWrite contex
185185
.build();
186186
}
187187

188-
private TableSchema<?> getTableSchemaForElementList(TableSchema<?> rootSchema, String key) {
189-
TableSchema<?> elementListSchema;
188+
private TableSchema<?> getTableSchemaForListElement(TableSchema<?> rootSchema, String key) {
189+
TableSchema<?> listElementSchema;
190190
try {
191191
if (!key.contains(NESTED_OBJECT_UPDATE)) {
192-
elementListSchema = TableSchema.fromClass(
192+
listElementSchema = TableSchema.fromClass(
193193
Class.forName(rootSchema.converterForAttribute(key).type().rawClassParameters().get(0).rawClass().getName()));
194194
} else {
195195
String[] parts = NESTED_OBJECT_PATTERN.split(key);
@@ -202,13 +202,13 @@ private TableSchema<?> getTableSchemaForElementList(TableSchema<?> rootSchema, S
202202
}
203203
}
204204
String attributeName = parts[parts.length - 1];
205-
elementListSchema = TableSchema.fromClass(
205+
listElementSchema = TableSchema.fromClass(
206206
Class.forName(currentSchema.converterForAttribute(attributeName).type().rawClassParameters().get(0).rawClass().getName()));
207207
}
208208
} catch (ClassNotFoundException e) {
209209
throw new IllegalArgumentException("Class not found for field name: " + key, e);
210210
}
211-
return elementListSchema;
211+
return listElementSchema;
212212
}
213213

214214
private Map<String, TableSchema<?>> resolveSchemasPerPath(Map<String, AttributeValue> attributesToSet,

0 commit comments

Comments
 (0)