Reflection of Java Class from Gradle

Hi,

I’d like to build some dynamic tasks which correspond directly with the public methods of one of my Java classes. How in Gradle could I inspect the public methods on the class, using reflection? I know how to use reflection, just cant wrap my head around getting the class into the classpath. I’ve got this so far:

task inspectClass << {
  //todo: load class 
  MyClass.class.getDeclaredMethods.each { method ->
    println method.name
  }
}