Skip to content

Instantly share code, notes, and snippets.

@wololock
Last active November 28, 2020 00:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save wololock/ac83a8196a8252fbbaacf4ac84e10b36 to your computer and use it in GitHub Desktop.
Save wololock/ac83a8196a8252fbbaacf4ac84e10b36 to your computer and use it in GitHub Desktop.
@Grab(group = "org.reflections", module = "reflections", version = "0.9.11")
@Grab(group = "org.slf4j", module = "slf4j-simple", version = "1.7.25")
import groovy.json.JsonOutput
import org.codehaus.groovy.reflection.GeneratedMetaMethod
import org.reflections.Reflections
def reflections = new Reflections("org.codehaus.groovy.runtime")
def json = reflections.getSubTypesOf(GeneratedMetaMethod).collect {
[name: it.name, allDeclaredConstructors: true, allPublicConstructors: true, allDeclaredMethods: true, allPublicMethods: true]
}
new File('dgm.json').withWriter {
it.write(JsonOutput.prettyPrint(JsonOutput.toJson(json)))
}
@wololock
Copy link
Author

wololock commented Jan 16, 2019

Run

groovy dgm.groovy > dgm.json

to generate reflection configuration file.

@Joxebus
Copy link

Joxebus commented Nov 28, 2020

Thanks for this script, I was experimenting with Groovy and GraalVM and this was really helpful instead of add one by one the reflections that are not present 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment