groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Narahari Lakshminarayana <itsme.narah...@gmail.com>
Subject groovyscript and binding, what is wrong in this code
Date Wed, 20 Mar 2019 22:23:23 GMT
Friends:

Thank you in advance for your help.

I have the following groovyscript code.

def zebra_test1_list = [ "zebra1", "zebra2" ]
def zebra_test2_list = [ "zebra3", "zebra4" ]

def data="test1"
def zebra = groovy.util.Eval.me("zebra_${data}_list")

println zebra


I get the error

groovy> def zebra_test1_list = [ "zebra1", "zebra2" ]
groovy> def zebra_test2_list = [ "zebra3", "zebra4" ]
groovy> def data="test1"
groovy> def zebra = groovy.util.Eval.me("zebra_${data}_list")
groovy> println zebra

Exception thrown

groovy.lang.MissingPropertyException: No such property: zebra_test1_list
for class: Script1
at Script1.run(Script1.groovy:1)
at ConsoleScript2.run(ConsoleScript2:5)


Please help as to what I might be doing wrong.

-N

Mime
View raw message