How to copy properties from one Bean to Another and ignore nested Object's property

Abhi

I am working on a logic to copy properties from one bean to another bean in Java. I used BeanUtils to copy the properties and it works perfectly. Issue is that I want to ignore few properties of nested object but BeanUtils ignore properties work for only top level properties. Is there any util or library to do that ? This is how my code is

class A{
 private String name;
 private List<B> bArr;
 }

Class B {
int age;
int taxID;
}

So I want to hide taxID from list of bArr. Is there a way to do this?

Jorge García

you can use modelmapper and config as you want!!

you have several ways to configure it

<dependency>
    <groupId>org.modelmapper</groupId>
    <artifactId>modelmapper</artifactId>
    <version>2.3.5</version>
</dependency>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

how to copy s3 object from one bucket to another using python boto3

Copy properties from one bean to another (not the same class) recursively (including nested beans)

How to copy properties from a bean to another bean in different class?

How to copy properties from one Java bean to another?

Copy POJO content from one bean to another

Spring Bean copy properties ignore child's object null values

angularjs - copy common properties from one object to another

How to copy an object from one type to another in Java?

How to copy all user provided styles from one object to another

Accessing Properties of one Object from another Object

How would you check if property name(s) from one object exist in another?

How to add properties from one object into another without overwriting in Javascript

How to copy the month value from one Date object to another?

How to assign specific properties from one object to another

How to pass bean property from one view to another view

how to copy properties from one google chrome user to another on OSX

How to efficiently copy properties from an object to another?

Javascript - Deep copy specific properties from one object to another new object

How to copy properties from one .net object to another

How to pass an origin object(NOT COPY) from one activity to another on Android

How to copy CSS properties from one div to another?

How to copy dictionary object value from one key to another?

Shell script - How to copy the last modified AWS S3 Object from one bucket to another?

How to copy an object from one bucket to another

How can I selectively copy properties from one object to another in TypeScript

How to assign an object's property to another one of it's properties in reactjs?

How to copy some properties from an object to another

How to copy an array to another array with one property which is an object

How to filter few properties of an object which is in Array of objects if one property equals property from another object