Jan
Jan

Reputation: 1445

List of all domain classes in Grails

how can I get a list of alle domain classes I use in my project? Something like GORM.domains.list().

Upvotes: 13

Views: 7085

Answers (1)

Stefan Armbruster
Stefan Armbruster

Reputation: 39925

Using

grailsApplication.getArtefacts("Domain")

you get a list of GrailsDomainClass instances that hold meta-information regarding the domain class. The domain class itself is returned by Calling getClazz(). In short:

grailsApplication.getArtefacts("Domain")*.clazz

returns a complete list of the existing domain classes.

Upvotes: 28

Related Questions