Is this possible and if, how?
item.foo = "moo" def x = "foo" item.[x] = "moo"
I'm not sure I get your question, but...
def item = { def foo } def x = "foo" item[x] = "moo" assert item[x] == "moo" assert item.foo == "moo"