deps: Refactor dependencies (#3224)

* remove spring dep
move junit, logging, mockito under dep mgmt

* upgrade anti-corruption-layer deps

* async method invocation

* balking, bloc

* bridge to bytecode

* caching

* callback - cqrs

* component - health check

* hexagonal - metadata mapping

* rest of the patterns

* remove checkstyle, take spotless into use
This commit is contained in:
Ilkka Seppälä
2025-03-29 19:34:27 +02:00
committed by GitHub
parent 371439aeaa
commit 0ca162a55c
1863 changed files with 14408 additions and 17637 deletions
+6 -3
View File
@@ -26,6 +26,7 @@ package com.iluwatar;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* The `App` class demonstrates the functionality of the {@link Money} class, which encapsulates
* monetary values and their associated currencies. It showcases operations like addition,
@@ -41,6 +42,7 @@ public class App {
// Initialize the logger
private static final Logger logger = Logger.getLogger(App.class.getName());
/**
* Program entry point.
*
@@ -79,11 +81,12 @@ public class App {
try {
double exchangeRateUsdToEur = 0.85; // Example exchange rate
usdAmount1.exchangeCurrency("EUR", exchangeRateUsdToEur);
logger.log(Level.INFO, "USD converted to EUR: {0} {1}", new Object[]{usdAmount1.getAmount(), usdAmount1.getCurrency()});
logger.log(
Level.INFO,
"USD converted to EUR: {0} {1}",
new Object[] {usdAmount1.getAmount(), usdAmount1.getCurrency()});
} catch (IllegalArgumentException e) {
logger.log(Level.SEVERE, "Error converting currency: {0}", e.getMessage());
}
}
}
@@ -23,9 +23,8 @@
* THE SOFTWARE.
*/
package com.iluwatar;
/**
* An exception for when the user tries to add two diffrent currencies.
*/
/** An exception for when the user tries to add two diffrent currencies. */
public class CannotAddTwoCurrienciesException extends Exception {
/**
* Constructs an exception with the specified message.
@@ -35,4 +34,4 @@ public class CannotAddTwoCurrienciesException extends Exception {
public CannotAddTwoCurrienciesException(String message) {
super(message);
}
}
}
@@ -23,8 +23,10 @@
* THE SOFTWARE.
*/
package com.iluwatar;
/**
* An exception for when the user tries to subtract two different currencies or subtract an amount he doesn't have.
* An exception for when the user tries to subtract two different currencies or subtract an amount
* he doesn't have.
*/
public class CannotSubtractException extends Exception {
/**
@@ -35,5 +37,4 @@ public class CannotSubtractException extends Exception {
public CannotSubtractException(String message) {
super(message);
}
}
+7 -5
View File
@@ -27,9 +27,9 @@ package com.iluwatar;
import lombok.Getter;
/**
* Represents a monetary value with an associated currency.
* Provides operations for basic arithmetic (addition, subtraction, multiplication),
* as well as currency conversion while ensuring proper rounding.
* Represents a monetary value with an associated currency. Provides operations for basic arithmetic
* (addition, subtraction, multiplication), as well as currency conversion while ensuring proper
* rounding.
*/
@Getter
public class Money {
@@ -74,13 +74,15 @@ public class Money {
* Subtracts another Money object from the current instance.
*
* @param moneyToBeSubtracted the Money object to subtract.
* @throws CannotSubtractException if the currencies do not match or if the amount to subtract is larger than the current amount.
* @throws CannotSubtractException if the currencies do not match or if the amount to subtract is
* larger than the current amount.
*/
public void subtractMoney(Money moneyToBeSubtracted) throws CannotSubtractException {
if (!moneyToBeSubtracted.getCurrency().equals(this.currency)) {
throw new CannotSubtractException("You are trying to subtract two different currencies");
} else if (moneyToBeSubtracted.getAmount() > this.amount) {
throw new CannotSubtractException("The amount you are trying to subtract is larger than the amount you have");
throw new CannotSubtractException(
"The amount you are trying to subtract is larger than the amount you have");
}
this.amount = roundToTwoDecimals(this.amount - moneyToBeSubtracted.getAmount());
}