diff options
author | Jon Marius Venstad <jonmv@users.noreply.github.com> | 2020-10-01 15:54:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 15:54:32 +0200 |
commit | 1970a319908423d93164b5985a362285610eac9d (patch) | |
tree | 77e63e26dca5c105b836f17de4661ce2279bf5e1 /document | |
parent | 9c1cda0715260283b6a21081dc286ef86e3ab7b9 (diff) | |
parent | 6792ae6918439c535ff518107ad17351bb27fed1 (diff) |
Merge pull request #14634 from vespa-engine/jonmv/async-feed-handler
Async document v1
Diffstat (limited to 'document')
4 files changed, 36 insertions, 2 deletions
diff --git a/document/abi-spec.json b/document/abi-spec.json index e53cf09f07e..c9191aa2fdb 100644 --- a/document/abi-spec.json +++ b/document/abi-spec.json @@ -399,6 +399,8 @@ "public com.yahoo.document.DocumentId getId()", "public void <init>(com.yahoo.document.DocumentPut)", "public void <init>(com.yahoo.document.DocumentPut, com.yahoo.document.Document)", + "public boolean equals(java.lang.Object)", + "public int hashCode()", "public java.lang.String toString()" ], "fields": [] @@ -1929,6 +1931,8 @@ "public java.lang.String getSelection()", "public boolean isPresent()", "public static com.yahoo.document.TestAndSetCondition fromConditionString(java.util.Optional)", + "public boolean equals(java.lang.Object)", + "public int hashCode()", "public java.lang.String toString()" ], "fields": [ diff --git a/document/src/main/java/com/yahoo/document/DocumentPut.java b/document/src/main/java/com/yahoo/document/DocumentPut.java index c5ce2e7e181..e24388cd65f 100644 --- a/document/src/main/java/com/yahoo/document/DocumentPut.java +++ b/document/src/main/java/com/yahoo/document/DocumentPut.java @@ -1,6 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document; +import java.util.Objects; + /** * @author Vegard Sjonfjell */ @@ -47,6 +49,20 @@ public class DocumentPut extends DocumentOperation { } @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DocumentPut that = (DocumentPut) o; + return document.equals(that.document) && + getCondition().equals(that.getCondition()); + } + + @Override + public int hashCode() { + return Objects.hash(document, getCondition()); + } + + @Override public String toString() { return "put of document " + getId(); } diff --git a/document/src/main/java/com/yahoo/document/TestAndSetCondition.java b/document/src/main/java/com/yahoo/document/TestAndSetCondition.java index 6a189fc2969..a582807e38c 100644 --- a/document/src/main/java/com/yahoo/document/TestAndSetCondition.java +++ b/document/src/main/java/com/yahoo/document/TestAndSetCondition.java @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.document; +import java.util.Objects; import java.util.Optional; /** @@ -43,6 +44,19 @@ public class TestAndSetCondition { } @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + TestAndSetCondition that = (TestAndSetCondition) o; + return conditionStr.equals(that.conditionStr); + } + + @Override + public int hashCode() { + return Objects.hash(conditionStr); + } + + @Override public String toString() { StringBuilder string = new StringBuilder(); string.append("condition '"); diff --git a/document/src/main/java/com/yahoo/document/json/TokenBuffer.java b/document/src/main/java/com/yahoo/document/json/TokenBuffer.java index e20845bfa54..88353139b0f 100644 --- a/document/src/main/java/com/yahoo/document/json/TokenBuffer.java +++ b/document/src/main/java/com/yahoo/document/json/TokenBuffer.java @@ -129,7 +129,7 @@ public class TokenBuffer { add(t, tokens.getCurrentName(), tokens.getText()); } catch (IOException e) { // TODO something sane - throw new RuntimeException(e); + throw new IllegalArgumentException(e); } } @@ -138,7 +138,7 @@ public class TokenBuffer { return tokens.nextValue(); } catch (IOException e) { // TODO something sane - throw new RuntimeException(e); + throw new IllegalArgumentException(e); } } |