• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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 ??
 
reply
    Bookmark Topic Watch Topic
  • New Topic