String to Object re-construction

I Have an Object. I have to transfer this Object thru Clipboard as an String only.

How can I reconstrcut the object from its String value.

eg. Color.red in String becomes java.awt.Color[r=255,g=0,b=0]

I want Color.red back from this above String.

I guess, I have to use Reflection. Any help pls?

Thanks

[339 byte] By [chandrajeeta] at [2007-11-26 13:45:47]
# 1
Use full words. 'pls' is a pain in the *** to read.My first thought would be to use a string parser to pull the R, G, Bvalues, and then use the Color(int, int, int) constructor.
es5f2000a at 2007-7-8 1:20:32 > top of Java-index,Java Essentials,Java Programming...
# 2
You might be able to convert Color's toString() value back to a Color object, but you aren't going to be able to do that in general.Why do you have to use a String to transfer your data? At least on Windows the clipboard supports all kinds of data, not just text.
DrClapa at 2007-7-8 1:20:32 > top of Java-index,Java Essentials,Java Programming...
# 3

Yes the clipboard supports. But I use swing and don't know whether the Transferable supports Object[] or ArrayList of objects. By the way I got the Color.getRGB and passed that as String instead of the whole color object.

If you know how to transfer(DragnDrop) object array, pls le'me know.

Thanks

chandrajeeta at 2007-7-8 1:20:32 > top of Java-index,Java Essentials,Java Programming...
# 4
I am rather certain that serialization is text only.So just serialize the object to a string using the appropriate Object and String IO classes.And reverse it to load it back in.And if serialization isn't text then just convert the bytes to base64 and then back
jschella at 2007-7-8 1:20:33 > top of Java-index,Java Essentials,Java Programming...
# 5
What about the Transfer of Objects in Swing, any help?
chandrajeeta at 2007-7-8 1:20:33 > top of Java-index,Java Essentials,Java Programming...
# 6
> What about the Transfer of Objects in Swing, any help?Huh? What does that have to do with the clip board?
jschella at 2007-7-8 1:20:33 > top of Java-index,Java Essentials,Java Programming...
# 7
No I was asking if there is a way to transfer object array in swing DnD?Regards
chandrajeeta at 2007-7-8 1:20:33 > top of Java-index,Java Essentials,Java Programming...
# 8
> No I was asking if there is a way to transfer object> array in swing DnD?Are you asking a different question than your original post?If no then as I said, serialization.If yes then you need to ask a complete question.
jschella at 2007-7-8 1:20:33 > top of Java-index,Java Essentials,Java Programming...