I am currently dealing with an AWS Java SDK that expects Java types.
I used JavaConvertersto explicitly convert types, such as maps and lists, to java. I came across more complex types and found that I had to go into cards that became cumbersome.
My current problem: I have Map[String, List[String]]converting a shared object to java is simple, but it erases me when the type erases when the template matches the list on the map.
val t = m.map{
case (k, v: List[String]) => k -> v
}
I found a great explanation of type tags in Scala, which is an elegant solution that I would like to implement. Scala: what is TypeTag and how to use it?
I just don’t know how I implement this in my template.
I implemented a method that looks like this
def isNestedMap[A : TypeTag](xs: A): Boolean = typeOf[A] match {
case t if t =:= typeOf[Map[String, List[String]]] => true
case t => false
}
case (k, v) if isNestedMap(v) => k -> "beans", false, Any.
, ? java?
.
EDIT: Map[String, Any], Any, Java