Class BatchItems<T>
java.lang.Object
com.helixframework.api.contract.batch.BatchItems<T>
- Type Parameters:
T- the type of items in the batch
Represents a batch of items, containing a list of successful items and a list of failed items.
-
Constructor Summary
ConstructorsConstructorDescriptionBatchItems(List<T> success, List<BatchFailure> failure) Initializes a new instance of the BatchItems class with the specified lists of successful items and failed items. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFailure(BatchFailure value) Adds a failure to the list of failed items in the batch.voidaddFailure(Collection<BatchFailure> value) Adds a collection of failures to the batch.voidaddSuccess(Collection<T> values) Adds a collection of successful items to the batch.voidaddSuccess(T value) Adds a successful item to the batch.Retrieves a list of failed items from the batch.longReturns the total number of failed items in the batch.Retrieves a list of successful items from the batch.longRetrieves the total number of successful items in the batch.longgetTotal()Returns the total count of items in the batch response.
-
Constructor Details
-
BatchItems
Initializes a new instance of the BatchItems class with the specified lists of successful items and failed items.- Parameters:
success- a list of successful itemsfailure- a list of failed items
-
-
Method Details
-
addSuccess
Adds a successful item to the batch.- Parameters:
value- the item to add
-
addSuccess
Adds a collection of successful items to the batch.- Parameters:
values- the collection of successful items to add
-
addFailure
Adds a failure to the list of failed items in the batch.- Parameters:
value- theBatchFailureobject representing the failure to be added
-
addFailure
Adds a collection of failures to the batch.- Parameters:
value- the collection of failures to add
-
getSuccesses
Retrieves a list of successful items from the batch.- Returns:
- a list of successful items
-
getFailures
Retrieves a list of failed items from the batch.- Returns:
- a list of failed items
-
getTotal
public long getTotal()Returns the total count of items in the batch response. The getTotal method calculates the total count of items in the batch response by summing the number of successful items and the number of failed items. It does not -
getSuccessTotal
public long getSuccessTotal()Retrieves the total number of successful items in the batch.- Returns:
- the total number of successful items
-
getFailureTotal
public long getFailureTotal()Returns the total number of failed items in the batch.- Returns:
- the total number of failed items
-