Various cleanups according to code check
This commit is contained in:
@@ -34,6 +34,6 @@ public enum ResponseReason {
|
||||
}
|
||||
|
||||
public ResponseEntity toResponseEntity() {
|
||||
return new ResponseEntity(this.name(), this.httpStatus);
|
||||
return new ResponseEntity<>(this.name(), this.httpStatus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class FinancerConfig {
|
||||
* via {@link FinancerConfig#getCountryCode}.
|
||||
*/
|
||||
public HolidayCalendar getHolidayCalendar() {
|
||||
final Optional<HolidayCalendar> optionalHoliday = Arrays.asList(HolidayCalendar.values()).stream()
|
||||
final Optional<HolidayCalendar> optionalHoliday = Arrays.stream(HolidayCalendar.values())
|
||||
.filter((hc) -> hc.getId().equals(this.countryCode))
|
||||
.findFirst();
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@ public enum AccountStatus {
|
||||
/** Indicates that the account is open for bookings */
|
||||
OPEN,
|
||||
/** Indicates that the account is closed and bookings to it are forbidden */
|
||||
CLOSED;
|
||||
CLOSED
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ public enum AccountType {
|
||||
* @return whether the given type represents a valid account type
|
||||
*/
|
||||
public static boolean isValidType(String type) {
|
||||
return Arrays.asList(AccountType.values()).stream().anyMatch((accountType) -> accountType.name().equals(type));
|
||||
return Arrays.stream(AccountType.values()).anyMatch((accountType) -> accountType.name().equals(type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,6 @@ public enum HolidayWeekendType {
|
||||
* @return whether the given type represents a valid holiday weekend type
|
||||
*/
|
||||
public static boolean isValidType(String type) {
|
||||
return Arrays.asList(HolidayWeekendType.values()).stream().anyMatch((holidayWeekendType) -> holidayWeekendType.name().equals(type));
|
||||
return Arrays.stream(HolidayWeekendType.values()).anyMatch((holidayWeekendType) -> holidayWeekendType.name().equals(type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ public enum IntervalType {
|
||||
* @return whether the given type represents a valid interval type
|
||||
*/
|
||||
public static boolean isValidType(String type) {
|
||||
return Arrays.asList(IntervalType.values()).stream().anyMatch((intervalType) -> intervalType.name().equals(type));
|
||||
return Arrays.stream(IntervalType.values()).anyMatch((intervalType) -> intervalType.name().equals(type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,14 +44,14 @@ public class AccountService {
|
||||
* @return all possible account types as specified by the {@link AccountType} enumeration, never <code>null</code>
|
||||
*/
|
||||
public Iterable<String> getAccountTypes() {
|
||||
return Arrays.asList(AccountType.values()).stream().map(AccountType::name).collect(Collectors.toList());
|
||||
return Arrays.stream(AccountType.values()).map(AccountType::name).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return all possible account status as specified by the {@link AccountStatus} enumeration, never <code>null</code>
|
||||
*/
|
||||
public Iterable<String> getAccountStatus() {
|
||||
return Arrays.asList(AccountStatus.values()).stream().map(AccountStatus::name).collect(Collectors.toList());
|
||||
return Arrays.stream(AccountStatus.values()).map(AccountStatus::name).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +93,7 @@ public class AccountService {
|
||||
// If we create an account it's implicitly open
|
||||
account.setStatus(AccountStatus.OPEN);
|
||||
// and has a current balance of 0
|
||||
account.setCurrentBalance(Long.valueOf(0l));
|
||||
account.setCurrentBalance(Long.valueOf(0L));
|
||||
|
||||
try {
|
||||
this.accountRepository.save(account);
|
||||
|
||||
@@ -330,7 +330,7 @@ public class RecurringTransactionService {
|
||||
response = ResponseReason.INVALID_BOOKING_ACCOUNTS;
|
||||
} else if (amount == null) {
|
||||
response = ResponseReason.MISSING_AMOUNT;
|
||||
} else if (amount == 0l) {
|
||||
} else if (amount == 0L) {
|
||||
response = ResponseReason.AMOUNT_ZERO;
|
||||
} else if (holidayWeekendType == null) {
|
||||
response = ResponseReason.MISSING_HOLIDAY_WEEKEND_TYPE;
|
||||
@@ -382,7 +382,7 @@ public class RecurringTransactionService {
|
||||
|
||||
return this.transactionService.createTransaction(recurringTransaction.getFromAccount().getKey(),
|
||||
recurringTransaction.getToAccount().getKey(),
|
||||
amount.orElseGet(() -> recurringTransaction.getAmount()),
|
||||
amount.orElseGet(recurringTransaction::getAmount),
|
||||
LocalDate.now().format(DateTimeFormatter.ofPattern(this.financerConfig.getDateFormat())),
|
||||
recurringTransaction.getDescription(),
|
||||
recurringTransaction);
|
||||
|
||||
@@ -154,7 +154,7 @@ public class TransactionService {
|
||||
response = ResponseReason.INVALID_BOOKING_ACCOUNTS;
|
||||
} else if (amount == null) {
|
||||
response = ResponseReason.MISSING_AMOUNT;
|
||||
} else if (amount == 0l) {
|
||||
} else if (amount == 0L) {
|
||||
response = ResponseReason.AMOUNT_ZERO;
|
||||
} else if (date == null) {
|
||||
response = ResponseReason.MISSING_DATE;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class SendRecurringTransactionReminderTask {
|
||||
.append(System.lineSeparator())
|
||||
.append(System.lineSeparator());
|
||||
|
||||
IterableUtils.toList(recurringTransactions).stream().forEach((rt) -> {
|
||||
IterableUtils.toList(recurringTransactions).forEach((rt) -> {
|
||||
reminderBuilder.append(rt.getId())
|
||||
.append("|")
|
||||
.append(rt.getDescription())
|
||||
|
||||
Reference in New Issue
Block a user