I need to write a generic method to get all fields of an object and it's value, the class of this object may contains ClassTag, so we should find a way to get it as well, is any way good way ? the difficulty is we don't know the class ahead, it may contains ClassTag (zero to many), It may not.
For example,
class A(x : Int) {}
a = new A(1)
We should output x => 1
class B[T: ClassTag]() {}
b = new B[Float]()
We should output _$1 = Float
Aucun commentaire:
Enregistrer un commentaire