From e4a97716f8459c6d7647af787c36d1102b7b558d Mon Sep 17 00:00:00 2001 From: Albert Chae Date: Thu, 7 Nov 2024 07:40:11 -0800 Subject: [PATCH] private and comments --- inngest/src/main/kotlin/com/inngest/Function.kt | 3 ++- inngest/src/main/kotlin/com/inngest/State.kt | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/inngest/src/main/kotlin/com/inngest/Function.kt b/inngest/src/main/kotlin/com/inngest/Function.kt index 119abf0..af6dc25 100644 --- a/inngest/src/main/kotlin/com/inngest/Function.kt +++ b/inngest/src/main/kotlin/com/inngest/Function.kt @@ -260,7 +260,7 @@ internal open class InternalInngestFunction( return configBuilder.build(client.appId, serveUrl) } - fun serializeStepData(stepData: Any?): JsonNode? { + private fun serializeStepData(stepData: Any?): JsonNode? { if (stepData == null) { return stepData } @@ -270,6 +270,7 @@ internal open class InternalInngestFunction( val readOnlyJson = mapper.readTree(jsonString) if (!readOnlyJson.isObject) { + // primitives can be serialized directly return readOnlyJson } diff --git a/inngest/src/main/kotlin/com/inngest/State.kt b/inngest/src/main/kotlin/com/inngest/State.kt index ff7bb9b..0c640b6 100644 --- a/inngest/src/main/kotlin/com/inngest/State.kt +++ b/inngest/src/main/kotlin/com/inngest/State.kt @@ -72,10 +72,10 @@ class State( return null } - fun deserializeStepData(serializedStepData: JsonNode?, type: Class): T? { + private fun deserializeStepData(serializedStepData: JsonNode?, type: Class): T? { val mapper = ObjectMapper() if (serializedStepData == null || !serializedStepData.isObject || !serializedStepData.has("class")) { - // handles null and primitives + // null and primitives can be deserialized directly return mapper.treeToValue(serializedStepData, type) }