From b7840245f08aabf6b5a4f03dff0a51f956246383 Mon Sep 17 00:00:00 2001 From: Jon Austen Date: Tue, 22 Dec 2015 19:21:23 -0800 Subject: [PATCH] Added Javadoc comments to AmortizationService class. --- .../MortgageCalculatorController.java | 2 +- .../core/service/AmortizationService.java | 23 +++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/main/java/app/finance/core/controller/MortgageCalculatorController.java b/src/main/java/app/finance/core/controller/MortgageCalculatorController.java index 85e3e48..3d0acab 100644 --- a/src/main/java/app/finance/core/controller/MortgageCalculatorController.java +++ b/src/main/java/app/finance/core/controller/MortgageCalculatorController.java @@ -33,7 +33,7 @@ public String calculatePayments(@ModelAttribute MonthlyAmortizationSchedule mont { System.out.println( "There are errors! " + bindingResult.getAllErrors().toString() ); } - amortizationService.initMonthlyAmortizationSchedule(monthlyAmortizationSchedule); + amortizationService.initializeUnknownFields(monthlyAmortizationSchedule); model.addAttribute(monthlyAmortizationSchedule); return "schedule"; diff --git a/src/main/java/app/finance/core/service/AmortizationService.java b/src/main/java/app/finance/core/service/AmortizationService.java index a1cb1ed..4642e24 100644 --- a/src/main/java/app/finance/core/service/AmortizationService.java +++ b/src/main/java/app/finance/core/service/AmortizationService.java @@ -19,10 +19,10 @@ public class AmortizationService private PaymentService paymentService; /** - * Modifies reference to monthlyAmortizationSchedule before passing that model to redirected template. - * @param monthlyAmortizationSchedule + * Modifies reference to monthlyAmortizationSchedule to resolve values of empty fields. + * @param monthlyAmortizationSchedule object containing all required loan parameters and calculations */ - public void initMonthlyAmortizationSchedule(MonthlyAmortizationSchedule monthlyAmortizationSchedule) + public void initializeUnknownFields(MonthlyAmortizationSchedule monthlyAmortizationSchedule) { // extract required parameters Date startDate = monthlyAmortizationSchedule.getStartDate(); @@ -43,12 +43,12 @@ public void initMonthlyAmortizationSchedule(MonthlyAmortizationSchedule monthlyA /** * Calculates the monthly payment and the list of payments given parameters. - * @param startDate - * @param initialBalance - * @param durationInMonths - * @param paymentType - * @param interestRate - * @param futureValue + * @param startDate loan start date + * @param initialBalance loan initial balance + * @param durationInMonths loan duration in months + * @param paymentType loan payment type + * @param interestRate loan interest rate + * @param futureValue loan expected future value * @return List of payments and the monthly payment amount */ public List calculatePaymentList(Date startDate, double initialBalance, int durationInMonths, int paymentType, double interestRate, double futureValue) @@ -80,6 +80,11 @@ public List calculatePaymentList(Date startDate, double initialBalance, return paymentList; } + /** + * Adds a month to a date, for purposes of putting a date on each Payment object. + * @param date any arbitrary date + * @return Date a date one month later + */ private Date addOneMonth(Date date) { Calendar cal = Calendar.getInstance();