Created
June 20, 2014 16:31
-
-
Save okram/5aa6c9254ff900dd3704 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* @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