groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Matz <>
Subject Calling a static method by packagename.method
Date Thu, 07 Apr 2016 15:33:48 GMT
Hello!  I have some static methods defined and am able to access them after
I import, e,.g.
import static org.matz.utils.jira.*

With that import I can call the methods, e.g. createTicket, but I would
like to be able to call it as *jira*.createTicket, as is possible with the
Math package, e.g.

import static java.lang.Math.*
println "PI is ${PI} (${Math.PI})"

my method declaration in jira.groovy is (including the namespace):
package org.matz.jenkins

def static void createTicket(String changelog, String summary, Map config)
{ ... }

Does anyone know what I need to do to either my definitions, or import, or
something else to be able to refer to the createTicket method as
jira.createTicket?  I would like to be able to do this to avoid name
collisions as well as to be able to make explicit which "class" I'm calling
the method on.


View raw message