Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
268 views
in Technique[技术] by (71.8m points)

Groovy 3.0 - how to get all properties and methods of an object without any custom code

I remember in the earlier version of Groovy (Groovy 2 or above), we used to get all the properties and methods of a class without any custom code, more so with the "." operator or something. But I am not getting them in Groovy 3.0.

As of now, I am able to do the following.

def num = 0
num.getMetaClass().getMetaMethods().each { println it.name}

Is there a simple and easy syntax to this?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...