Hello

I am trying to use java to load groovy scripts. My requirements are


  *   Scripts have to be type checked. So I added a compilerConfiguration to 
use the ASTTransformationCustomizer for TypeChecked. That works
  *   My scripts will have properties it tries to access . These properties are 
dynamic in nature that I will know about only just before I load the script. 
For example, I may have a variable CARMAKE that I can use in the script and I 
know it has to be set to FORD only when I load the script. So to do this, I 
enabled ExpandoMetaClass.enableGlobally so all my groovy scripts will use the 
expandometaclass.
  *   I added a base
  *   I then created a groovyshell and parsed my file to get a script object.
  *   I then got the expandometaclass for my script object and added my CARMAKE 
parameter.
  *   This does not work if I reference the CARMAKE variable in the script, 
because it is dynamically injected after the compile step and I have turned on 
type checking.
  *   This works if I have turned off TypeChecked

So my question is this. How do I inject the dynamic parameters and values into 
the script class  before I parse/compile my script file? kind of intercept the 
parse right after the metaclass is created, add my variables and then have it 
compile the script.


regards




--
View this message in context: 
http://groovy.329449.n5.nabble.com/TypeChecked-and-with-custom-methods-parameters-using-ExpandoMetaClass-tp5733289.html
Sent from the Groovy Users mailing list archive at Nabble.com.

Reply via email to