I never faced a requirement like that and I am pretty confused how can I implement that.
Lets consider the following Beans:
Company{
String companyName;
String companyId;
Person person;
//getter and setters
}
Person{
String id;
String name;
String lastName;
List<Address> address;
//getter and setters
}
Address{
String id;
String name;
String description;
//getter and setters
}
So the hierarchy would be like this:
Company has Person has Address
What I have to do is, replace all String fields with other String, for instance
Company.companyName = "Hi there #xyz"
Address.name = "St. Example #xyz"
I need to replace the char #xyx with #abcd, for instance.
The object is much more complex than that and has a huge hierarchy.
I tried to find some API that would help me to do that, however I couldn't find anyone (I don't know if look correctly).
A solution that I have is in each getter method replace the char, however I don't think that is the best way to solve that.
I appreciate your help.
Thanks in advance.
I could solve that using reflection. I did not find any API.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.