Last active
June 4, 2024 08:17
-
-
Save HopefulLlama/edecc82e9e6145544f34 to your computer and use it in GitHub Desktop.
Print all properties of a Groovy object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
println object.properties | |
.sort{it.key} | |
.collect{it} | |
.findAll{!['class', 'active'].contains(it.key)} | |
.join('\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It can sometimes be useful to remove 'class' from line 4, if you are interested in the class of the object too.