Skip to content

Instantly share code, notes, and snippets.

@okram
Created June 20, 2014 16:31
Show Gist options
  • Save okram/5aa6c9254ff900dd3704 to your computer and use it in GitHub Desktop.
Save okram/5aa6c9254ff900dd3704 to your computer and use it in GitHub Desktop.
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
public class GremlinGroovySSupplier<A> implements SSupplier<A> {
private final String groovyScript;
private final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine();
public GremlinGroovySSupplier(final String groovyScript) {
this.groovyScript = groovyScript;
}
public A get() {
try {
return (A) this.engine.eval(this.groovyScript);
} catch (final ScriptException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment