diff options
Diffstat (limited to 'vespajlib/src/main/java')
-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; |