From 4167b044a13e832aa9449d54915c6a09d442a14e Mon Sep 17 00:00:00 2001 From: Richard Green Date: Wed, 23 Mar 2016 12:17:30 +0000 Subject: [PATCH 1/2] Field name request from client --- core/src/main/kotlin/core/FinanceTypes.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/core/FinanceTypes.kt b/core/src/main/kotlin/core/FinanceTypes.kt index f987f0a4bc..c03c3b52c9 100644 --- a/core/src/main/kotlin/core/FinanceTypes.kt +++ b/core/src/main/kotlin/core/FinanceTypes.kt @@ -225,7 +225,7 @@ fun LocalDate.isWorkingDay(accordingToCalendar: BusinessCalendar): Boolean = acc * typical feature of financial contracts, in which a business may not want a payment event to fall on a day when * no staff are around to handle problems. */ -open class BusinessCalendar private constructor(val holidayDates: List) { +open class BusinessCalendar private constructor(val calendars:String, val holidayDates: List) { class UnknownCalendar(name: String): Exception("$name not found") companion object { @@ -239,7 +239,7 @@ open class BusinessCalendar private constructor(val holidayDates: List Date: Wed, 23 Mar 2016 13:42:52 +0000 Subject: [PATCH 2/2] Made calendars property a string array rather than just string --- core/src/main/kotlin/core/FinanceTypes.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/core/FinanceTypes.kt b/core/src/main/kotlin/core/FinanceTypes.kt index c03c3b52c9..3885575176 100644 --- a/core/src/main/kotlin/core/FinanceTypes.kt +++ b/core/src/main/kotlin/core/FinanceTypes.kt @@ -225,7 +225,7 @@ fun LocalDate.isWorkingDay(accordingToCalendar: BusinessCalendar): Boolean = acc * typical feature of financial contracts, in which a business may not want a payment event to fall on a day when * no staff are around to handle problems. */ -open class BusinessCalendar private constructor(val calendars:String, val holidayDates: List) { +open class BusinessCalendar private constructor(val calendars: Array, val holidayDates: List) { class UnknownCalendar(name: String): Exception("$name not found") companion object { @@ -239,7 +239,7 @@ open class BusinessCalendar private constructor(val calendars:String, val holida fun parseDateFromString(it: String) = LocalDate.parse(it, DateTimeFormatter.ISO_LOCAL_DATE) /** Returns a business calendar that combines all the named holiday calendars into one list of holiday dates. */ - fun getInstance(vararg calname: String) = BusinessCalendar( calname.joinToString(","), + fun getInstance(vararg calname: String) = BusinessCalendar(calname, calname.flatMap { (TEST_CALENDAR_DATA[it] ?: throw UnknownCalendar(it)).split(",") }. toSet(). map{ parseDateFromString(it) }.