dev.gradleplugins.internal.dsl.groovy.GroovyDslRuntimeExtensions.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-plugin-development Show documentation
Show all versions of gradle-plugin-development Show documentation
Gradle plugin development plugins.
package dev.gradleplugins.internal.dsl.groovy
/**
* Helper class to add extension methods to Groovy DSL classes at runtime.
* The end result is comparable to the Kotlin extension methods.
*/
class GroovyDslRuntimeExtensions {
/**
* Add an extension methods to an object.
*
* @param self the object to extend
* @param methodName the extension method name
* @param methodBody the extension method body
*/
static void extendWithMethod(Object self, String methodName, Closure methodBody) {
self.metaClass."${methodName}" = methodBody
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy