Given a functor of a generic Any type, how can I cast an explicity named argument? For instance, I have a JsonArray (vertx) that is essentially a type of List<Any>... I can cast to JsonObject using the implicit it, but if I were to name it participant how can I cast as JsonObject?
val participants = conversation
.getJsonArray("participants")
.map{ (it as JsonObject)
it.getInteger("id")
}
My IDE complains no matter what I throw at it. Is this even possible? Something like:
val participants = conversation
.getJsonArray("participants")
.map{ (participant as JsonObject) ->
participant.getInteger("id")
}
.map{ (it as JsonObject).getInteger("id") }?itexplicitly likeparticipantto disambiguate nested mapping functionits... but(participant as JsonObject)doesnt compile.