Adding or overriding static methods |
Static methods can also be added using the same technique as instance methods with the addition of the "static" qualifier before the method name:
class Book {
String title
}
Book.metaClass.static.create << { String title -> new Book(title:title) }
def b = Book.create("The Stand")
|