-
Notifications
You must be signed in to change notification settings - Fork 74
MLE-26918 Refactor: Changed config class back to a non-record class #1910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -14,10 +14,17 @@ | |||||
| * | ||||||
| * @since 8.1.0 | ||||||
| */ | ||||||
| public record IncrementalWriteConfig(String hashKeyName, String timestampKeyName, boolean canonicalizeJson, | ||||||
| Consumer<DocumentWriteOperation[]> skippedDocumentsConsumer, | ||||||
| String[] jsonExclusions, String[] xmlExclusions, Map<String, String> xmlNamespaces, | ||||||
| String schemaName, String viewName) { | ||||||
| public class IncrementalWriteConfig { | ||||||
|
|
||||||
| private final String hashKeyName; | ||||||
| private final String timestampKeyName; | ||||||
| private final boolean canonicalizeJson; | ||||||
| private final Consumer<DocumentWriteOperation[]> skippedDocumentsConsumer; | ||||||
| private final String[] jsonExclusions; | ||||||
| private final String[] xmlExclusions; | ||||||
| private final Map<String, String> xmlNamespaces; | ||||||
| private final String schemaName; | ||||||
| private final String viewName; | ||||||
|
|
||||||
| public IncrementalWriteConfig(String hashKeyName, String timestampKeyName, boolean canonicalizeJson, | ||||||
| Consumer<DocumentWriteOperation[]> skippedDocumentsConsumer, | ||||||
|
|
@@ -34,11 +41,39 @@ public IncrementalWriteConfig(String hashKeyName, String timestampKeyName, boole | |||||
| this.viewName = viewName; | ||||||
| } | ||||||
|
|
||||||
| public String getHashKeyName() { | ||||||
| return hashKeyName; | ||||||
| } | ||||||
|
|
||||||
| public String getTimestampKeyName() { | ||||||
| return timestampKeyName; | ||||||
| } | ||||||
|
|
||||||
| public boolean isCanonicalizeJson() { | ||||||
| return canonicalizeJson; | ||||||
| } | ||||||
|
|
||||||
| public Consumer<DocumentWriteOperation[]> getSkippedDocumentsConsumer() { | ||||||
| return skippedDocumentsConsumer; | ||||||
| } | ||||||
|
|
||||||
| public String[] getJsonExclusions() { | ||||||
| return jsonExclusions; | ||||||
| } | ||||||
|
|
||||||
| @Override | ||||||
| public Map<String, String> xmlNamespaces() { | ||||||
| public String[] getXmlExclusions() { | ||||||
| return xmlExclusions; | ||||||
|
||||||
| return xmlExclusions; | |
| return xmlExclusions != null ? xmlExclusions.clone() : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The array fields
jsonExclusionsandxmlExclusionsshould be defensively copied in their getters to prevent external modification. Unlike Java records which automatically provide defensive copies for arrays, the current implementation allows callers to modify the internal array state. Consider returningArrays.copyOf(jsonExclusions, jsonExclusions.length)orjsonExclusions != null ? jsonExclusions.clone() : nullinstead of returning the array directly.