diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/impl/JsonJvmObjectDeserializer.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/impl/JsonJvmObjectDeserializer.kt index e4a20462aa..82c84b65a9 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/impl/JsonJvmObjectDeserializer.kt +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/impl/JsonJvmObjectDeserializer.kt @@ -74,6 +74,10 @@ class JsonJvmObjectDeserializer( val constructorArgs: Array = jvmObject.jvmCtorArgs.map { x -> instantiate(x) }.toTypedArray() when { + Class::class.java.isAssignableFrom(clazz) -> { + val x = constructorArgs.map { ca -> ca as String }.first() + return Class.forName(x) + } DoubleArray::class.java.isAssignableFrom(clazz) -> { return constructorArgs .map { ca -> ca as Double } diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/test/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/impl/JsonJvmObjectDeserializerTest.kt b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/test/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/impl/JsonJvmObjectDeserializerTest.kt index 0853fa7541..e9cc8f7c0c 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/test/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/impl/JsonJvmObjectDeserializerTest.kt +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/test/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/impl/JsonJvmObjectDeserializerTest.kt @@ -9,12 +9,35 @@ enum class Direction { NORTH, SOUTH, WEST, EAST } +class TestTxData {} class JsonJvmObjectDeserializerTest { companion object { val deserializer = JsonJvmObjectDeserializer() } + + @Test + fun classForNameHappyPath() { + + val jvmObject = JvmObject( + jvmTypeKind = JvmTypeKind.REFERENCE, + jvmType = JvmType( + fqClassName = Class::class.java.name + ), + jvmCtorArgs = listOf( + JvmObject( + jvmTypeKind = JvmTypeKind.PRIMITIVE, + jvmType = JvmType(String::class.java.name), + primitiveValue = TestTxData::class.java.name + ) + ) + ) + + val deserializedObject = deserializer.instantiate(jvmObject) + + assert(deserializedObject == TestTxData::class.java) + } @Test fun enumHappyPath() { val actual = Direction.WEST