List of usage examples for org.apache.commons.lang.math JVMRandom JVMRandom
public JVMRandom()
From source file:org.sapia.soto.state.code.GroovyStep.java
private Class generate() throws Exception { if (_src == null) { throw new IllegalStateException("Groovy source not specified"); }//from ww w . j a v a 2s . c om String src = _src; String crlf = System.getProperty("line.separator"); synchronized (_groovyLock) { src = _imports.toString() + "public class Soto_State_Java_" + getName() + "_" + new JVMRandom().nextLong() + " implements org.sapia.soto.state.Step{" + crlf + " public String getName(){ " + crlf + "return \"" + getName() + "\"; " + crlf + "}" + crlf + " public void execute(" + Result.class.getName() + " result){" + crlf + src + crlf + " }" + crlf + "}"; ByteArrayInputStream bis = new ByteArrayInputStream(src.getBytes()); GroovyClassLoader loader = new GroovyClassLoader(Thread.currentThread().getContextClassLoader()); return loader.parseClass(bis, getName()); } }