}
public Object methodMissing(String name, Object args)
throws MacroEvaluationException, IOException, InterruptedException {
TokenMacro macro = null;
for(TokenMacro m : TokenMacro.all()) {
if(m.acceptsMacroName(name)) {
macro = m;
break;
}
}
if(macro == null) {
for(TokenMacro m : ContentBuilder.getPrivateMacros()) {
if(m.acceptsMacroName(name)) {
macro = m;
break;
}
}
}
if(macro != null) {
Map<String, String> argsMap = new HashMap<String, String>();
ListMultimap<String, String> argsMultimap = ArrayListMultimap.create();
populateArgs(args, argsMap, argsMultimap);
// Get the build and listener from the binding.
AbstractBuild<?, ?> build = (AbstractBuild<?, ?>)this.getBinding().getVariable("build");
TaskListener listener = (TaskListener)this.getBinding().getVariable("listener");
return macro.evaluate(build, listener, name, argsMap, argsMultimap);
}
return String.format("[Could not find content token (check your usage): %s]", name);
}