开发者

Hows the syntax to getProperty dynamically?

Is thi开发者_如何学运维s possible and if, how?

item.foo = "moo"

def x = "foo"
item.[x] = "moo"


I'm not sure I get your question, but...

def item = {
    def foo
}
def x = "foo"
item[x] = "moo"

assert item[x] == "moo"
assert item.foo == "moo"
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜