From 19e5587a9f5204e96fc4b111f3611d62ecae5ce0 Mon Sep 17 00:00:00 2001 From: David Denton Date: Tue, 6 Feb 2024 08:47:41 +0000 Subject: [PATCH] add default args to containers --- .../main/kotlin/dev/forkhandles/data/JsonNodeDataContainer.kt | 2 +- data4k/src/main/kotlin/dev/forkhandles/data/MapDataContainer.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data4k/src/main/kotlin/dev/forkhandles/data/JsonNodeDataContainer.kt b/data4k/src/main/kotlin/dev/forkhandles/data/JsonNodeDataContainer.kt index a84a950..72e177e 100644 --- a/data4k/src/main/kotlin/dev/forkhandles/data/JsonNodeDataContainer.kt +++ b/data4k/src/main/kotlin/dev/forkhandles/data/JsonNodeDataContainer.kt @@ -23,7 +23,7 @@ import java.math.BigInteger /** * Jackson JsonNode-based implementation of the DataContainer */ -open class JsonNodeDataContainer(input: JsonNode) : +open class JsonNodeDataContainer(input: JsonNode = instance.objectNode()) : DataContainer( input, { content, it -> content.has(it) }, diff --git a/data4k/src/main/kotlin/dev/forkhandles/data/MapDataContainer.kt b/data4k/src/main/kotlin/dev/forkhandles/data/MapDataContainer.kt index 4efa1c4..520acde 100644 --- a/data4k/src/main/kotlin/dev/forkhandles/data/MapDataContainer.kt +++ b/data4k/src/main/kotlin/dev/forkhandles/data/MapDataContainer.kt @@ -3,7 +3,7 @@ package dev.forkhandles.data /** * Map-based implementation of the DataContainer */ -open class MapDataContainer(input: Map) : +open class MapDataContainer(input: Map = emptyMap()) : DataContainer>(input.toMutableMap(), { content, it -> content.containsKey(it) }, { content, it -> content[it] }, { map, name, value -> map[name] = value }