public class ExternalUtility
extends java.lang.Object
| Constructor and Description |
|---|
ExternalUtility() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
dumpConstructors(java.lang.Class classInQuestion) |
static java.lang.String |
dumpMethods(java.lang.Class classInQuestion) |
static java.lang.ClassLoader |
getGradleClassloader(java.lang.ClassLoader parentClassLoader,
java.io.File gradleHomeDirectory,
boolean showDebugInfo)
Call this to get a classloader that has loaded gradle.
|
static java.io.File |
getGradleJar(java.io.File gradleHomeDirectory)
This locates the gradle jar.
|
static java.lang.Object |
invokeStaticMethod(java.lang.Class classToInvoke,
java.lang.String methodName,
java.lang.Class[] argumentsClasses,
java.lang.Object... argumentValues)
This wraps up invoking a static method into a single call.
|
static java.lang.Class |
loadGradleClass(java.lang.String classToLoad,
java.lang.ClassLoader parentClassLoader,
java.io.File gradleHomeDirectory,
boolean showDebugInfo)
This attempts to load the a class from the specified gradle home directory.
|
public static java.lang.ClassLoader getGradleClassloader(java.lang.ClassLoader parentClassLoader,
java.io.File gradleHomeDirectory,
boolean showDebugInfo)
throws java.lang.Exception
parentClassLoader - Your classloader. Probably the classloader of whatever class is calling this.gradleHomeDirectory - the root directory of a gradle installationshowDebugInfo - true to show some additional information that may be helpful diagnosing problems is this failsjava.lang.Exceptionpublic static java.io.File getGradleJar(java.io.File gradleHomeDirectory)
gradleHomeDirectory - the root directory of a gradle installation. We're expecting this to have a child directory named 'lib'.public static java.lang.String dumpConstructors(java.lang.Class classInQuestion)
public static java.lang.String dumpMethods(java.lang.Class classInQuestion)
public static java.lang.Class loadGradleClass(java.lang.String classToLoad,
java.lang.ClassLoader parentClassLoader,
java.io.File gradleHomeDirectory,
boolean showDebugInfo)
throws java.lang.Exception
classToLoad - the full path to the class to loadparentClassLoader - Your classloader. Probably the classloader of whatever class is calling this.gradleHomeDirectory - the root directory of a gradle installationshowDebugInfo - true to show some additional information that may be helpful diagnosing problems is this failsjava.lang.Exceptionpublic static java.lang.Object invokeStaticMethod(java.lang.Class classToInvoke,
java.lang.String methodName,
java.lang.Class[] argumentsClasses,
java.lang.Object... argumentValues)
throws java.lang.Exception
classToInvoke - the class that has the methodmethodName - the name of the method to invokeargumentsClasses - the classes of the arguments (we can't determine this from the argumentValues because they can be of class A, but implement class B and B is be the argument type of the
method in questionargumentValues - the values of the arguments.java.lang.ExceptionCopyright © 2013. All rights reserved