I am trying to access a nested field using gstring but it throws exception groovy.lang.MissingPropertyException
I have two classes
Class Person{
Address address
}
Class Address{
String city
}
Somewhere in my code I am doing,
def person = Person.get(1)
def field = "address.city"
def city = person."${field}"
The line where I am trying to fetch city from person is throwing groovy.lang.MissingPropertyException
If I try to fetch a direct property using gstring it works but the above given code doesnt work.
Any help?