Dynamic Loading of Other Groovy Functions
Fred Eisele <[email protected]>
| Newsgroups | gmane.comp.lang.groovy.user |
|---|---|
| Message-ID | <[email protected]> |
I have a driver class (currently written in python) that · reads a csv file of command records which describe functions, the driver · loads groovy functions (as text strings) · the driver edits (textually) the groovy functions to add parameters · passes that groovy command to a database server (gremlin-server) which · processes the request and · returns the result. I would like to make a few changes to this process. - replace python driver with a groovy script (python gremlin driver is missing some features) - dynamically load the groovy functions (not as text strings) - communicate with the database server in the binary format (not as text) To do this I need to know… Is possible to dynamically load groovy scripts? e.g. if I have a groovy script ‘foo.groovy’ and a variable `x = ‘foo’` can I use the variable `x` to invoke a function in `foo.groovy`? I know I can run `foo.groovy`.execute() as a separate process but I need to capture the result, plus I do not want to incur the added computational cost.