I noticed an interesting behavior when working with parameters in Moqui. If I send a map-like structure as a parameter, for example:
[name: "Jerry", age: 42, city: "New York"]
When I check its class type in Moqui’s context, I get java.lang.String
. However, if I define the same structure statically in Groovy code like this:
def staticType = [name: "Jerry", age: 42, city: "New York"]
println "itemsType " + staticType.getClass().getName()
The type is java.util.LinkedHashMap
.
Why is the parameter treated as a java.lang.String
? Is there a way to directly work with it as a Map
in Moqui?
Here’s the overall code for context:
<service verb="test" noun="Service">
<in-parameters>
<parameter name="item" type="Map" />
</in-parameters>
<actions>
<script><![CDATA[
def itemType = item.getClass().getName()
println "itemsType " + itemType // java.lang.String
def staticType = [name: "Jerry", age: 42, city: "New York"]
println "itemsType " + staticType.getClass().getName() // java.util.LinkedHashMap
]]></script>
</actions>
</service>
Any insights would be appreciated!