• Post Reply Bookmark Topic Watch Topic
  • New Topic

PersistanceDelegate for Extended Objects  RSS feed

 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • 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 ??
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!