Reputation: 38704
The JavaDoc of ConfigSlurper
says
Settings can either be bound into nested maps or onto a specified JavaBean instance.
How does the latter work?
I only find examples of using the result as map or properties.
Upvotes: 2
Views: 510
Reputation: 171124
Given two beans:
@groovy.transform.ToString
class Child {
Integer age
}
@groovy.transform.ToString
class Bean {
String name
Child child
}
We can parse some config into a Bean
:
Bean b = new ConfigSlurper().parse('''
name = 'tim'
child {
age = 5
}
''')
Then printing b
gives:
Bean(tim, Child(5))
Upvotes: 2