scala - 获取 Scala 类对象中具有值的所有公共字段
问题描述
如何从 Scala 类的对象中获取所有公共字段(包括继承的)及其值?
这个:
class A(val a: String)
class B(val b: String) extends A("a")
val b = new B("b")
b.getClass.getFields
返回空列表。
解决方案
推荐阅读
- sql - 根据其他列的条件删除重复行
- c# - 超出列表的大小,在 C#、LINQ 中调用 ToList() 时我丢失了元素
- c# - 由于 WCF 中的 DataContract 等效性,CommunicationObjectFaultedException
- c# - 比较两个不同大小的字符串相似度
- php - 将过滤器添加到 acf 关系字段
- python - Unexpected result in pandas pivot_table
- r - 如何在 R 中创建邮政编码边界
- coq - 部分 Coq 标准库无法加载
- javascript - 如何发出路由器事件
- php - 如果值与PHP中数组中的其他值相关,如何从数组中删除数组?