I have a class, say

class Foo {
  def fooEcho()
    echo "Hello Foo"
  }
}


but of course this fails if I

Foo foo = new Foo()
foo.fooEcho()



because the Foo class doesn't know about Script echo() function. The 
general workaround is to do

class Foo {
  Foo(Script s) {
    this.script = s
  }
  def fooEcho() {
    script.echo "Hello Foo"
  }
  def script = null
}

Foo foo = new Foo(this)
foo.fooEcho()

But this is ugly, and it means that I have to prepend ALL normal Script 
calls (echo, println, stage, etc.) with "script."

Can Foo be defined as

class Foo extends Script {
 ...
}

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/632a36b4-7f37-409b-a37f-541124df2706%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to