开发者

build new obj with parent information

开发者 https://www.devze.com 2023-03-08 00:09 出处:网络
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: Pa开发者_StackOverflow社区rticipant is parent class of Winner, so I

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: Pa开发者_StackOverflow社区rticipant 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!


Try this:

new Winner(par.properties)


Maybe:

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

精彩评论

暂无评论...
验证码 换一张
取 消