获取域类字段名称 [英] Get domain class field names
本文介绍了获取域类字段名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获得一个类的字段名称,并将它存储在一个列表中。谁能帮忙?感谢。
I would like to get the field names of a class and maybe store it in a list. Can anyone help? Thanks.
推荐答案
您可以尝试获取域名的字段名称。
You can try this to get field names of domain class.
YourClass.declaredFields.each {
if (!it.synthetic) {
println it.name
}
}
这篇关于获取域类字段名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文