Skip to content

Package: ResultList

ResultList

nameinstructionbranchcomplexitylinemethod
ResultList(long)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
add(Object)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getResult()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getTotalCount()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getTotalHitsExceedsCount()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
setTotalHitsExceedsCount(boolean)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2017, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.service.elasticsearch.client.model;
14:
15: import java.util.ArrayList;
16: import java.util.List;
17:
18: /**
19: * Query result list definition.
20: *
21: * @param <T> {@link ResultList} object type.
22: * @since 1.0.0
23: */
24: public class ResultList<T> {
25:
26: private final List<T> result;
27: private final long totalCount;
28: private boolean totalHitsExceedsCount; //true iff in ES there are actually more than 10k hits
29:
30: /**
31: * Constructor.
32: *
33: * @param totalCount The total count of matched objects.
34: * @since 1.0.0
35: */
36: public ResultList(long totalCount) {
37: result = new ArrayList<>();
38:
39: this.totalCount = totalCount;
40: }
41:
42: /**
43: * Adds a object to the {@link ResultList}.
44: *
45: * @param object The object to add to the {@link ResultList}.
46: * @since 1.0.0
47: */
48: public void add(T object) {
49: result.add(object);
50: }
51:
52: public void setTotalHitsExceedsCount(boolean value) {
53: this.totalHitsExceedsCount=value;
54: }
55:
56: public boolean getTotalHitsExceedsCount() {
57: return this.totalHitsExceedsCount;
58: }
59:
60: /**
61: * Gets the {@link List} of results.
62: *
63: * @return The {@link List} of results.
64: * @since 1.0.0
65: */
66: public List<T> getResult() {
67: return result;
68: }
69:
70: /**
71: * Gets the total count of matched objects.
72: *
73: * @return The total count of matched objects.
74: * @since 1.0.0
75: */
76: public long getTotalCount() {
77: return totalCount;
78: }
79:
80: }