diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2024-04-18 13:14:04 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2024-04-18 13:14:04 +0200 |
commit | 1b5eeb6a730364586dfe7b438140269b2352f36c (patch) | |
tree | b9be240313584bf7238fac04c157e5da4009fbc7 /vespajlib | |
parent | 2230b5937514d9563311b8b9e395672eaa6786a4 (diff) |
Move Results to the only place it is used.
Diffstat (limited to 'vespajlib')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/errorhandling/Results.java | 58 | ||||
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/errorhandling/package-info.java | 5 |
2 files changed, 0 insertions, 63 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/errorhandling/Results.java b/vespajlib/src/main/java/com/yahoo/errorhandling/Results.java deleted file mode 100644 index 939d2276efc..00000000000 --- a/vespajlib/src/main/java/com/yahoo/errorhandling/Results.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.errorhandling; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * @author Tony Vaagenes - */ -public class Results<DATA, ERROR> { - - private final List<DATA> data; - private final List<ERROR> errors; - - public Results(List<DATA> data, List<ERROR> errors) { - this.data = List.copyOf(data); - this.errors = List.copyOf(errors); - } - - public boolean hasErrors() { - return !errors.isEmpty(); - } - - public List<DATA> data() { - return data; - } - - public List<ERROR> errors() { - return errors; - } - - public static class Builder<DATA, ERROR> { - private final List<DATA> data = new ArrayList<>(); - private final List<ERROR> errors = new ArrayList<>(); - - public void addData(DATA d) { - data.add(d); - } - - public void addAllData(Collection<? extends DATA> d) { - data.addAll(d); - } - - public void addError(ERROR e) { - errors.add(e); - } - - public void addAllErrors(Collection<? extends ERROR> e) { - errors.addAll(e); - } - - public Results<DATA, ERROR> build() { - return new Results<>(data, errors); - } - } - -} diff --git a/vespajlib/src/main/java/com/yahoo/errorhandling/package-info.java b/vespajlib/src/main/java/com/yahoo/errorhandling/package-info.java deleted file mode 100644 index ac6c913381c..00000000000 --- a/vespajlib/src/main/java/com/yahoo/errorhandling/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -@ExportPackage -package com.yahoo.errorhandling; - -import com.yahoo.osgi.annotation.ExportPackage; |