How to parse multiple classes from groovy file

Is there a way to parse all classes in a groovy script? In Parse ONE class right now:

java.lang.Class clazz = groovyClassLoader.parseClass(new File("MainApp.groovy"))

MainApp.groovy:

class MainApp {
   def doIt() {}
}

class OtherMainApp {
  def doTheRest() {}
}

This will return only MainApp.

I would like something like this:

java.lang.Class[] clazz = groovyClassLoader.parseClass(new File("MainApp.groovy"))

where clazz contains will contain both the MainApp class and the OtherMainApp class

Basically, I want to be able to retrieve all declared classes in a script.

Due to the nature of the application that I am creating the groovyc team will not help

Thank,

Federico

+3
source share
1 answer

No:

http://jira.codehaus.org/browse/GROOVY-3793

: ( {}), . ? . ? . ? . ? Groovy .

+1

Source: https://habr.com/ru/post/1747407/


All Articles