class LoanDurationInAccountingYearsCalculatorFactory {

    public LoanDurationInAccountingYearsCalculator create(RecurrenceType recurrenceType) {
        switch (recurrenceType) {
        case MONTHLY:
            return new LoanDurationInAccountingYearsCalculatorFactoryForMonthlyRecurrence();
        case WEEKLY:
            return new LoanDurationInAccountingYearsCalculatorFactoryForWeeklyRecurrence();
        case DAILY:
            return new LoanDurationInAccountingYearsCalculatorFactoryForDailyRecurrence();
        default:
            throw new BusinessRuleException(AccountConstants.NOT_SUPPORTED_DURATION_TYPE);
        }
    }

}