Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Java have a method to inspect object type?

In Javascript, if you want to inspect some object in chrome,

console.log(object) will printout variables, and methods about the object.

Ruby also has object.inspect which returns basic information about the object.

What code should I use in Java to inspect an object?

like image 745
user482594 Avatar asked Dec 27 '22 14:12

user482594


1 Answers

All the code you need to inspect Java objects is in the java.lang.reflect package.

You'll have to write a fair bit of code yourself using that API though.

Apache's BeanUtils is somewhat easier.

like image 118
Paul Grime Avatar answered Dec 31 '22 13:12

Paul Grime