grails根据domain类获取属性
/********
*获取对象属性
*o为类
*********/
def getCProperty(Object o){
// println o.toString().split(" ")[1]
def tripCla=grailsApplication.getArtefact("Domain",o.toString().split(" ")[1])
tripCla.getProperties().each{
println "getCProperty:"+it.name+"__________"+it.type
}
}
调用:
getCProperty(User)//获取对象属性