How to access a field's value via reflection (Scala 2.8)

前端 未结 5 1980
北海茫月
北海茫月 2021-02-08 00:18

Consider the following code:

class Foo(var name: String = \"bar\")

Now i try to get the value and the correct type of it via reflection:

<
5条回答
  •  独厮守ぢ
    2021-02-08 00:41

    AFAIK, reflection always work with Object, and you have to cast the results yourself.

提交回复
热议问题