Reputation: 231
I want to retrieve list of member variables of a specified class along with other information like datatype, size, value,etc. This is possible using Reflection class. But is there any way other than Reflection class to get this information? Thanks in advance.
Upvotes: 2
Views: 190
Reputation: 514
The question is why do you think reflection is not suitable for you? It made much faster in java 1.5 comparing to previous java releases.
Upvotes: 1
Reputation: 943
Apache commons-lang package has a very useful tool: ReflectionToStringBuilder. Here is the link to javadoc: http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/builder/ReflectionToStringBuilder.html
Upvotes: 0
Reputation: 3192
Just use the methods provided by the field class
of your class. See object Class.
Upvotes: 1
Reputation: 41
The org.springframework.util.ReflectionUtils class is actually quite the helper in these cases.
Upvotes: 0