I am looking for a commons beanutils alternative. The reason is that beanutils relies on commons-logging which is conflicting with existing libraries I am using.
I would like a small self-contained alternative which will cause no/minimal conflicts.
The main functionality I am after is nested property retrieval.
Thanks in advance, Steven
The Java BeanUtils are the components of the Apache Commons which are derived from JavaAPI and provides component architecture for the Java language. The Java BeanUtils design patterns uses utility classes that helps to get and set the property values on Java classes for retrieving and defining the bean properties.
Copying properties of one object to another object is often tedious and error-prone for developers. BeanUtils class provides a copyProperties method that copies the properties of source object to target object where the property name is same in both objects.
As they both ultimately use Reflection you aren't likely to notice much difference, unless the higher-level API is doing things you don't need done. See also java. beans.
While property handling is not the main focus of Jackson, it can be used for that, as per this article.
The basic idea is that you can not only read/write JSON to/from POJOs, but also do compatible conversions: including that of "serializing" a POJO as a Java Map. Since you can go back and forth between representations you basically get a bean introspector for free.
Jackson has no external dependencies, but you need both core (streaming api, impls) and mapper jars (data binding).
Jodd has very good collection of libraries, See if Jodd BeanUtil helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With