Grails GORM: How to do reflexion on embedded domains? -
i want reflexion on domain associations automatically generate json/xml format class descriptor file restful ws (scaffolding).
example domains are:
class roof { chimney chimney = new chimney() static embedded = ['chimney'] } class chimney { float height } i using code know gorm class type:
grailsdomainclasspersistententity entity = roof.gormpersistententity entity?.persistentproperties.each { persistentproperty property -> class<?> cl = property.gettype() } when property association, cl variable gets class of associated domain. works when association standard hasone or hasmany. problem found that, when property embedded, type of class results in org.codehaus.groovy.grails.commons.defaultgrailsdomainclassproperty.
i don't know way find class of embebded property. posibilitity (embedded static attribute... etc.)?
edit:embedded e = property e.getassociatedentity() //null
check value of embedded field of domain class , scan class properties' names matches
grails gorm
No comments:
Post a Comment