diff options
Diffstat (limited to 'vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ResultImpl.java')
-rw-r--r-- | vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ResultImpl.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ResultImpl.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ResultImpl.java new file mode 100644 index 00000000000..dabf76cba34 --- /dev/null +++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/ResultImpl.java @@ -0,0 +1,44 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package ai.vespa.feed.client.impl; + +import ai.vespa.feed.client.DocumentId; +import ai.vespa.feed.client.Result; + +import java.util.Optional; + +/** + * Result for a document operation which completed normally. + * + * @author bjorncs + * @author jonmv + */ +public class ResultImpl implements Result { + + private final Type type; + private final DocumentId documentId; + private final String resultMessage; + private final String traceMessage; + + ResultImpl(Type type, DocumentId documentId, String resultMessage, String traceMessage) { + this.type = type; + this.documentId = documentId; + this.resultMessage = resultMessage; + this.traceMessage = traceMessage; + } + + @Override public Type type() { return type; } + @Override public DocumentId documentId() { return documentId; } + @Override public Optional<String> resultMessage() { return Optional.ofNullable(resultMessage); } + @Override public Optional<String> traceMessage() { return Optional.ofNullable(traceMessage); } + + @Override + public String toString() { + return "Result{" + + "type=" + type + + ", documentId=" + documentId + + ", resultMessage='" + resultMessage + '\'' + + ", traceMessage='" + traceMessage + '\'' + + '}'; + } + +} |