Skip to content

Instantly share code, notes, and snippets.

@HopefulLlama
Last active December 6, 2022 12:18
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save HopefulLlama/edecc82e9e6145544f34 to your computer and use it in GitHub Desktop.
Save HopefulLlama/edecc82e9e6145544f34 to your computer and use it in GitHub Desktop.
Print all properties of a Groovy object
println object.properties
.sort{it.key}
.collect{it}
.findAll{!['class', 'active'].contains(it.key)}
.join('\n')
@HopefulLlama
Copy link
Author

Based on:
http://padcom13.blogspot.co.uk/2009/12/groovy-dumping-objects-properties.html

Published:
25/12/2009 🎄

Accessed:
16/03/2016

@HopefulLlama
Copy link
Author

It can sometimes be useful to remove 'class' from line 4, if you are interested in the class of the object too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment