FINERACT-2326: Refractor redundant and some deprecated code as per new Java 21 style (Phase 2)

This commit is contained in:
Aman-Mittal
2025-12-17 08:51:47 +01:00
committed by Adam Saghy
parent 695816f990
commit 4bfae0400c
21 changed files with 196 additions and 206 deletions
@@ -81,8 +81,7 @@ public final class AccountingConstants {
}
public static CashAccountsForLoan fromInt(final int i) {
final CashAccountsForLoan type = intToEnumMap.get(Integer.valueOf(i));
return type;
return intToEnumMap.get(i);
}
}
@@ -142,8 +141,7 @@ public final class AccountingConstants {
}
public static AccrualAccountsForLoan fromInt(final int i) {
final AccrualAccountsForLoan type = intToEnumMap.get(Integer.valueOf(i));
return type;
return intToEnumMap.get(i);
}
}
@@ -297,8 +295,7 @@ public final class AccountingConstants {
}
public static CashAccountsForSavings fromInt(final int i) {
final CashAccountsForSavings type = intToEnumMap.get(Integer.valueOf(i));
return type;
return intToEnumMap.get(i);
}
}
@@ -346,8 +343,7 @@ public final class AccountingConstants {
}
public static AccrualAccountsForSavings fromInt(final int i) {
final AccrualAccountsForSavings type = intToEnumMap.get(Integer.valueOf(i));
return type;
return intToEnumMap.get(i);
}
}
@@ -492,8 +488,7 @@ public final class AccountingConstants {
}
public static FinancialActivity fromInt(final int financialActivityId) {
final FinancialActivity type = intToEnumMap.get(Integer.valueOf(financialActivityId));
return type;
return intToEnumMap.get(financialActivityId);
}
public static FinancialActivityData toFinancialActivityData(final int financialActivityId) {
@@ -506,8 +501,7 @@ public final class AccountingConstants {
}
private static FinancialActivityData convertToFinancialActivityData(final FinancialActivity type) {
FinancialActivityData financialActivityData = new FinancialActivityData(type.value, type.code, type.getMappedGLAccountType());
return financialActivityData;
return new FinancialActivityData(type.value, type.code, type.getMappedGLAccountType());
}
}
@@ -545,8 +539,7 @@ public final class AccountingConstants {
}
public static CashAccountsForShares fromInt(final int i) {
final CashAccountsForShares type = intToEnumMap.get(Integer.valueOf(i));
return type;
return intToEnumMap.get(i);
}
}
@@ -37,9 +37,7 @@ public final class AccountingEnumerations {
}
public static EnumOptionData gLAccountType(final GLAccountType accountType) {
final EnumOptionData optionData = new EnumOptionData(accountType.getValue().longValue(), accountType.getCode(),
accountType.toString());
return optionData;
return new EnumOptionData(accountType.getValue().longValue(), accountType.getCode(), accountType.toString());
}
public static List<EnumOptionData> gLAccountType(final GLAccountType[] accountTypes) {
@@ -55,9 +53,7 @@ public final class AccountingEnumerations {
}
public static EnumOptionData gLAccountUsage(final GLAccountUsage accountUsage) {
final EnumOptionData optionData = new EnumOptionData(accountUsage.getValue().longValue(), accountUsage.getCode(),
accountUsage.toString());
return optionData;
return new EnumOptionData(accountUsage.getValue().longValue(), accountUsage.getCode(), accountUsage.toString());
}
public static List<EnumOptionData> gLAccountUsage(final GLAccountUsage[] accountUsages) {
@@ -73,9 +69,7 @@ public final class AccountingEnumerations {
}
public static EnumOptionData journalEntryType(final JournalEntryType journalEntryType) {
final EnumOptionData optionData = new EnumOptionData(journalEntryType.getValue().longValue(), journalEntryType.getCode(),
journalEntryType.toString());
return optionData;
return new EnumOptionData(journalEntryType.getValue().longValue(), journalEntryType.getCode(), journalEntryType.toString());
}
public static List<EnumOptionData> journalEntryTypes(final JournalEntryType[] journalEntryTypes) {
@@ -91,9 +85,8 @@ public final class AccountingEnumerations {
}
public static EnumOptionData portfolioProductType(final PortfolioProductType portfolioProductType) {
final EnumOptionData optionData = new EnumOptionData(portfolioProductType.getValue().longValue(), portfolioProductType.getCode(),
return new EnumOptionData(portfolioProductType.getValue().longValue(), portfolioProductType.getCode(),
portfolioProductType.toString());
return optionData;
}
public static EnumOptionData accountingRuleType(final int id) {
@@ -101,8 +94,7 @@ public final class AccountingEnumerations {
}
public static EnumOptionData accountingRuleType(final AccountingRuleType type) {
final EnumOptionData optionData = new EnumOptionData(type.getValue().longValue(), type.getCode(), type.toString());
return optionData;
return new EnumOptionData(type.getValue().longValue(), type.getCode(), type.toString());
}
public static List<EnumOptionData> accountingRuleTypes(final AccountingRuleType[] accountingRuleTypes) {
@@ -45,8 +45,7 @@ public enum AccountingRuleType {
}
public static AccountingRuleType fromInt(final Integer ruleTypeValue) {
final AccountingRuleType type = intToEnumMap.get(ruleTypeValue);
return type;
return intToEnumMap.get(ruleTypeValue);
}
AccountingRuleType(final Integer value, final String code, final String description) {
@@ -44,26 +44,14 @@ public enum AccountType {
}
public static AccountType fromInt(final Integer accountTypeValue) {
AccountType enumeration = AccountType.INVALID;
switch (accountTypeValue) {
case 1:
enumeration = AccountType.INDIVIDUAL;
break;
case 2:
enumeration = AccountType.GROUP;
break;
case 3:
enumeration = AccountType.JLG;
break;
case 4:
enumeration = AccountType.GLIM;
break;
case 5:
enumeration = AccountType.GSIM;
break;
}
return enumeration;
return switch (accountTypeValue) {
case 1 -> AccountType.INDIVIDUAL;
case 2 -> AccountType.GROUP;
case 3 -> AccountType.JLG;
case 4 -> AccountType.GLIM;
case 5 -> AccountType.GSIM;
default -> AccountType.INVALID;
};
}
public static AccountType fromName(final String name) {