I want to get an array(or list) of a POJO's property names .
I tried commons-beanutil's BeanUtils.describe(obj)
, but it needs an object instance.
But what if I only have that class , without a public no-arg constructor . I cannot use clazz.newInstance()
to generate an object.
How should I solve it ? Is there any libraries that can dig into a class and pass property names ?
(I know I can use reflection to manually parse the class structure , but I am looking for a handy library)
Thanks.
I've never used it (or anything in java.beans
, for that matter), but java.beans.Introspector.getBeanInfo(Class)
may be what you're looking for.