Skip to content

Commit ab14af1

Browse files
authored
Use All-Args pattern instead of cast in updateConfigData (#332)
1 parent ca13e7b commit ab14af1

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

config-object-store/src/main/java/org/hypertrace/config/objectstore/IdentifiedObjectStoreWithFilter.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ private Optional<ContextualConfigObject<T>> filterObject(
7777

7878
private ContextualConfigObject<T> updateConfigData(
7979
ContextualConfigObject<T> configObject, T updatedData) {
80-
return ((ContextualConfigObjectImpl) configObject).toBuilder().data(updatedData).build();
80+
return new ContextualConfigObjectImpl<>(
81+
configObject.getContext(),
82+
updatedData,
83+
configObject.getCreationTimestamp(),
84+
configObject.getCreatedByEmail(),
85+
configObject.getLastUserUpdateTimestamp(),
86+
configObject.getLastUserUpdateEmail(),
87+
configObject.getLastUpdatedTimestamp(),
88+
configObject.getLastUpdateEmail());
8189
}
8290
}

0 commit comments

Comments
 (0)