Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

java-bean properties dynamic updation with type conversion . help.

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
this question may not be relevant to web services but I didn't know where to post, I frequent this forum so I thought I'll post it here.
The scenario is, I have to insert a customer into the customer database using a webservice. If the customer already exists but does not have complete details, this customer record has to be updated with the rest of the details like address, payment definiton etc. otherwise insert the whole record.
is there any way to update java bean properties dynamically with type conversion?
I have a few java-beans Customer, Address, Product, Order etc.
I'll have to read a properties file and update the beans with these values.
I had a look at jakarta commons-beanutils, with this normal string values work properly but when I have other datatypes like 'int' or 'long' it's not working. throwing a Typemismatch Exception.
Can anybody please suggest how to go about it? I thought of using a HashMap to store the property names as keys and appropriate wrapper classes as values. But when I invoke the setter method it returns an Object. I'm really stuck.
any input is greatly appreciated. a code example would be wonderful.
Thanks in advance.
Pavan
 
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest you post in the JSP or servlet forum (and maybe a bit clearer with sample code).
 
Catch Ernie! Catch the egg! And catch this tiny ad too:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic