summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2022-10-07 13:07:44 +0200
committerjonmv <venstad@gmail.com>2022-10-07 13:07:44 +0200
commite5dbf486e85ff0f8eb0aa3de0af51f9b8c169513 (patch)
treedc07741abaa0558b2914c471ce1034ea8695fa02
parent67afeb4c00ba1530a40bfcf1d7a863e276331871 (diff)
Convert record to class, since we need to build this for JDK 8
-rw-r--r--document/src/main/java/com/yahoo/document/json/ParsedDocumentOperation.java49
1 files changed, 42 insertions, 7 deletions
diff --git a/document/src/main/java/com/yahoo/document/json/ParsedDocumentOperation.java b/document/src/main/java/com/yahoo/document/json/ParsedDocumentOperation.java
index eb171983cf1..a395973a55a 100644
--- a/document/src/main/java/com/yahoo/document/json/ParsedDocumentOperation.java
+++ b/document/src/main/java/com/yahoo/document/json/ParsedDocumentOperation.java
@@ -3,14 +3,49 @@ package com.yahoo.document.json;
import com.yahoo.document.DocumentOperation;
+import java.util.Objects;
+
/**
* The result of JSON parsing a single document operation
- *
- * @param operation
- * the parsed operation
- * @param fullyApplied
- * true if all the JSON content could be applied,
- * false if some (or all) of the fields were not poresent in this document and was ignored
*/
-public record ParsedDocumentOperation(DocumentOperation operation, boolean fullyApplied) {
+public final class ParsedDocumentOperation {
+
+ private final DocumentOperation operation;
+ private final boolean fullyApplied;
+
+ /**
+ * @param operation the parsed operation
+ * @param fullyApplied true if all the JSON content could be applied,
+ * false if some (or all) of the fields were not poresent in this document and was ignored
+ */
+ public ParsedDocumentOperation(DocumentOperation operation, boolean fullyApplied) {
+ this.operation = operation;
+ this.fullyApplied = fullyApplied;
+ }
+
+ public DocumentOperation operation() { return operation; }
+
+ public boolean fullyApplied() { return fullyApplied; }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) return true;
+ if (obj == null || obj.getClass() != this.getClass()) return false;
+ var that = (ParsedDocumentOperation) obj;
+ return Objects.equals(this.operation, that.operation) &&
+ this.fullyApplied == that.fullyApplied;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(operation, fullyApplied);
+ }
+
+ @Override
+ public String toString() {
+ return "ParsedDocumentOperation[" +
+ "operation=" + operation + ", " +
+ "fullyApplied=" + fullyApplied + ']';
+ }
+
}