Skip to content

Instantly share code, notes, and snippets.

@debasishg
Created April 25, 2010 07:55
Show Gist options
  • Save debasishg/378252 to your computer and use it in GitHub Desktop.
Save debasishg/378252 to your computer and use it in GitHub Desktop.
public class RunScript {
public static void main(String[] args)
throws CompilationFailedException, IOException,
InstantiationException, IllegalAccessException {
final ClientOrder clientOrder = new ClientOrder();
clientOrder.run();
final Closure dsl =
(Closure)((Script) new GroovyClassLoader().parseClass(
new File("order.dsl")).newInstance()).run();
dsl.setDelegate(clientOrder);
final Object result = dsl.call();
List<Order> r = (List<Order>) result;
int val = 0;
for(Order x : r) {
val += (Integer)(x.getValue());
}
System.out.println(val);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment