copy from one bean to other bean


I am going through below link on how to copy from one bean to other bean

I have nto clearly understood how author is copy pasting.

I also did not see usage of ToStringBuilder method.

What is the practical use of ToStringBuilder method.

I also wonder why there is dependency bewteen
BeanUtils on the Commons lang and commons util jars

please advise
Any links resources ideas highly appreciated. Thanks in advance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

These classes are part of the Apache Jakarta Commons, in order to find out how they copy data from one bean to another you better look at the source code. I guess they use reflection to find the properties of one bean, and use the mutator methods of the second bean to set the values.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gudii9Author Commented:
reflection to find the properties of one bean

How to use the reflection and mutation to find the properties of beans. please advise
I think the best place to start is the java tutorial on reflection.
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

gudii9Author Commented:
I am referring the link(

They said as below which is not clear to me.
Every object is either a reference or primitive type
all of the wrapper classes for primitive types such as java.lang.Double, the interface, and the enum javax.swing.SortOrder.

How object can be primitive type?
also how serializable and SortOrder are primitive types.
please advise
It says the wrappers for the primitive types, not the primitive types. Read it again, it does not say the primitive types are objects.
gudii9Author Commented:
sounds good.

Every object is either a reference or primitive type

But above statement does not say wrapper. I wonder why. please advise
gudii9Author Commented:
I have not understood the gist of this example. what exactly author is trying to do.

     public FromBean(String name, String aProp, String bProp) {
   = name;
            this.aProp = aProp;
            this.bProp = bProp;

      public String getAProp() {
            return aProp;

      public void setAProp(String prop) {
            aProp = prop;

why there is no this for  setter methods (aProp = prop;)similar to constructor ( = name;)

why FromBean and ToBean has common properties like name, bProp

Is no argument constructor is mandotory for a bean even when there is argument constructor.
please advise
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.