Arthur Neves
Arthur Neves

Reputation: 12128

build new obj with parent information

I dont know if this is possible but what I want to do is:

def par = Participant.get(0)
new Winner(par)

explaining the code above: Participant is parent class of Winner, so I wanna create a Winner instance but copying all the fields which are filled in that participant.

Is that possible?! thanks!

Upvotes: 0

Views: 159

Answers (2)

Jim Norman
Jim Norman

Reputation: 749

Try this:

new Winner(par.properties)

Upvotes: 3

jjczopek
jjczopek

Reputation: 3379

Maybe:

def par = Participant.get(0)
def winner = new Winner()
bindData(winner, par)

Upvotes: 2

Related Questions