tags:

views:

21

answers:

1

According to Grails API, we can retrieve all domain classes definition through GrailsApplication as such

import org.codehaus.groovy.grails.commons.ApplicationHolder as AH   
 AH.application.domainClasses

I have classes defined under src/groovy and would like to do the same. I tried using the follwing code but in vain

    import org.codehaus.groovy.grails.commons.ApplicationHolder as AH   
 AH.application.allClasses

According to Grails API, call to getAllClasses should return all classes loaded by Grails class loader

Class[] getAllClasses() Retrieves all java.lang.Class instances loaded by the Grails class loader

Am i missing something

+2  A: 

Any Java or Groovy code can be placed in the src directory and does not have to integrate with Grails. The Grails class loader only loads Grails specific classes such as pluggins, controllers, and domain classes that your grails application knows about at run-time. In order to find out about classes located in your src directory you will need to know the package name your interested in and then iterate through everything contained in that package.

Jared