title: check in Jenkins pipeline if a loaded groovy script provides a specific closure
body: <p>In Jenkins pipeline I load a groovy script like this:</p>
  <pre><code>def myScript= load(&quot;myScript.groovy&quot;)
  myScript.foo(&quot;Hello&quot;)
  myScript.bar(&quot;World&quot;)
  </code></pre>
  <p>where <code>myScript.groovy</code> might look like:</p>
  <pre><code>public foo(String foo1)
  {  println foo1
  }
  public bar(String bar1)
  {  println bar1
  }
  return this
  </code></pre>
  <p>But I have an older version of <code>myScript.groovy</code> that doesn't implement <code>bar()</code> - how can I check if <code>bar()</code> is provided before calling it?<br>
  I could use <code>try</code> but I think there might be a better way...</p>