refactoring: Issue #2377: The repository code has been refactored to use the recor… (#2505)

* Issue #2377: The repository code has been refactored to use the record class

* Issue #2377: Refactored according to the rules defined for the repo code

* Issue #2377: Refactored according to the rules defined for the repo code

* Issue #2377: Refactored according to the rules defined for the repo code
This commit is contained in:
Mughees Qasim
2023-05-06 12:08:12 +03:00
committed by GitHub
parent c0e1603f90
commit 3ae6b07590
26 changed files with 244 additions and 293 deletions
@@ -37,21 +37,11 @@ import java.util.List;
*
* @author George Aristy (george.aristy@gmail.com)
*/
public final class FindCustomer implements BusinessOperation<String> {
private final String customerId;
private final Deque<BusinessException> errors;
/**
* Ctor.
*
* @param customerId the final result of the remote operation
* @param errors the errors to throw before returning {@code customerId}
*/
public record FindCustomer(String customerId, Deque<BusinessException> errors) implements BusinessOperation<String> {
public FindCustomer(String customerId, BusinessException... errors) {
this.customerId = customerId;
this.errors = new ArrayDeque<>(List.of(errors));
this(customerId, new ArrayDeque<>(List.of(errors)));
}
@Override
public String perform() throws BusinessException {
if (!this.errors.isEmpty()) {