开发者

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: 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜