mirror of
https://github.com/corda/corda.git
synced 2025-01-19 03:06:36 +00:00
Made calendars property a string array rather than just string
This commit is contained in:
parent
4167b044a1
commit
a0780c84a7
@ -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<LocalDate>) {
|
||||
open class BusinessCalendar private constructor(val calendars: Array<out String>, val holidayDates: List<LocalDate>) {
|
||||
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) }.
|
||||
|
Loading…
Reference in New Issue
Block a user