def ee = EngineeringElement.findByNameAndDataTypeCode(domain, headerCode)
if (!ee) {
ee = new EngineeringElement(name: domain, dataTypeCode: headerCode, parentElement: null)
engineeringElementService.save(ee)
def item = it.clazz
item.getDeclaredFields().each { ite ->
println("填写:${ite}")
}
}
输出结果:
注册:cn.edu.cup.physical.PhysicalQuantity
填写:private java.lang.String cn.edu.cup.physical.PhysicalQuantity.quantityName
填写:private java.lang.String cn.edu.cup.physical.PhysicalQuantity.englishName
填写:private java.lang.String cn.edu.cup.physical.PhysicalQuantity.symbol
填写:private java.lang.String cn.edu.cup.physical.PhysicalQuantity.unitNameISO
填写:private java.lang.String cn.edu.cup.physical.PhysicalQuantity.unitSymbolISO
填写:private java.util.SortedSet cn.edu.cup.physical.PhysicalQuantity.quantityUnits
填写:private static java.lang.Object cn.edu.cup.physical.PhysicalQuantity.hasMany
填写:private static java.lang.Object cn.edu.cup.physical.PhysicalQuantity.constraints
填写:public static final java.util.List cn.edu.cup.physical.PhysicalQuantity.$defaultDatabindingWhiteList
填写:private static org.grails.plugins.web.controllers.api.ControllersDomainBindingApi cn.edu.cup.physical.PhysicalQuantity.instanceControllersDomainBindingApi
填写:private static final transient org.slf4j.Logger cn.edu.cup.physical.PhysicalQuantity.log
填写:java.lang.Long cn.edu.cup.physical.PhysicalQuantity.id
填写:java.lang.Long cn.edu.cup.physical.PhysicalQuantity.version
填写:static java.lang.Object cn.edu.cup.physical.PhysicalQuantity.transients
填写:private static org.grails.plugins.converters.api.ConvertersApi cn.edu.cup.physical.PhysicalQuantity.instanceConvertersApi
填写:private transient java.util.Map cn.edu.cup.physical.PhysicalQuantity.org_grails_datastore_mapping_dirty_checking_DirtyCheckable__$changedProperties
填写:private org.springframework.validation.Errors cn.edu.cup.physical.PhysicalQuantity.org_grails_datastore_gorm_GormValidateable__errors
填写:private transient boolean cn.edu.cup.physical.PhysicalQuantity.org_grails_datastore_gorm_GormValidateable__skipValidate
填写:private static org.codehaus.groovy.reflection.ClassInfo cn.edu.cup.physical.PhysicalQuantity.$staticClassInfo
填写:public static transient boolean cn.edu.cup.physical.PhysicalQuantity.__$stMC
填写:private transient groovy.lang.MetaClass cn.edu.cup.physical.PhysicalQuantity.metaClass
填写:private static java.lang.ref.SoftReference cn.edu.cup.physical.PhysicalQuantity.$callSiteArray
基本上是想要的结果了,但是,还多一些东西。实际上只想要自己定义的内容。