Refactored MonthComparator into FiscalYearCalculator.
[fiscal-year.java.git] / src / main / java / com / github / sebhoss / time / FiscalYears.java
blob11512021c649157d4d89be7ac0aac5981bde91b8
1 /*
2 * This program is free software. It comes without any warranty, to
3 * the extent permitted by applicable law. You can redistribute it
4 * and/or modify it under the terms of the Do What The Fuck You Want
5 * To Public License, Version 2, as published by Sam Hocevar. See
6 * http://www.wtfpl.net/ for more details.
7 */
8 package com.github.sebhoss.time;
10 import org.joda.time.Months;
12 import com.github.sebhoss.common.annotation.CompilerWarnings;
14 /**
15 * TODO: document
17 public final class FiscalYears {
19 /**
20 * @param startMonth
21 * The calendar month in the previous calendar year where the fiscal year begins.
22 * @return A new factory which creates appropriate {@link FiscalDate}s.
24 @SuppressWarnings(CompilerWarnings.NULL)
25 public static FiscalYearFactory earlyFiscalYear(final int startMonth) {
26 return new FiscalYearFactory(Months.months(startMonth), new EarlyFiscalYearCalculator(startMonth));
29 /**
30 * @param startMonth
31 * The calendar month in the previous calendar year where the fiscal year begins.
32 * @return A new factory which creates appropriate {@link FiscalDate}s.
34 public static FiscalYearFactory earlyFiscalYear(final Months startMonth) {
35 return new FiscalYearFactory(startMonth, new EarlyFiscalYearCalculator(startMonth.getMonths()));
38 /**
39 * @param startMonth
40 * The calendar month in the current calendar year where the fiscal year begins.
41 * @return A new factory which creates appropriate {@link FiscalDate}s.
43 @SuppressWarnings(CompilerWarnings.NULL)
44 public static FiscalYearFactory lateFiscalYear(final int startMonth) {
45 return new FiscalYearFactory(Months.months(startMonth), new LateFiscalYearCalculator(startMonth));
48 /**
49 * @param startMonth
50 * The calendar month in the current calendar year where the fiscal year begins.
51 * @return A new factory which creates appropriate {@link FiscalDate}s.
53 public static FiscalYearFactory lateFiscalYear(final Months startMonth) {
54 return new FiscalYearFactory(startMonth, new LateFiscalYearCalculator(startMonth.getMonths()));
57 private FiscalYears() {
58 // Factory class