How to get ClassTag form TypeTag, or both at same time?

前端 未结 2 776
遥遥无期
遥遥无期 2020-11-29 11:48

I have some code like this:

class ReflectiveJsonFormat[T:TypeTag] extends JsonFormat[T] {
  def write(x: T) : JsValue = {
   val t = typeOf[T]
   val getters         


        
2条回答
  •  难免孤独
    2020-11-29 12:26

    Well scala does support multiple context bounds if that is what you are after:

    class ReflectiveJsonFormat[T:TypeTag:ClassTag] 
    

提交回复
热议问题