Created
April 25, 2010 07:55
-
-
Save debasishg/378252 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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