I'm pretty new to groovy so bear with me but I've got a bunch of similar code that I'm trying to feed into an array. It's pretty straightforward I have my array declaration at the top and then declaring variables similar to each other below. I only included three but in reality I have about 10. Except this isn't working and I have no ideas why? If anyone has any ideas it is greatly appreciated.
def properties = resource.adaptTo(ValueMap.class) ?: []
headerText = properties["headerText"] ?: ""
bodyText = properties["bodyText"] ?: ""
footerText = properties["footerText"] ?: ""
Error below:
Caused by: groovy.lang.MissingPropertyException: No such property: headerText for class
[:]? What's aValueMap? What'sresource.adaptTo? Does it include mapped property access? Does the property exist? etc.[:], as Dave said). Other languages (PHP, I'm looking at you) call that an "array" even 'though it's an associative map. And "array" in Java/Groovy is more like a list.