• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

PersistanceDelegate for Extended Objects

 
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all

I have a Javbean which extends java.awt.Color(Which doesn't have a no argument constructor) and when i try to write the class using XMLEncoder its throwing Exception as a custom persistance delegator needs to be there

My custom java bean looks like

Class CustomColor extends java.awt.Color
{
public CustomColor(Color c)
{
super(c.getRed(), c.getGreen(), c.getBlue());
// Some more variables
}
}


How to set the new PersistanceDelegate for this class ??
I tried to use
encoder.setPersistenceDelegate(CustomColor.class,
new DefaultPersistenceDelegate(
new String[]{ "red",
"green",
"blue" }) );

But its not working ... I am not in a position to make that bean with out a constructor and provide a set and get methods for it

Can any one let me know how to write Delegates for this class ??
 
permaculture is largely about replacing oil with people. And one tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic