Samuel,

I really need to finally get around to building some built-in descriptors for Swing/AWT.

Anyway, you can do it a few ways.

The easiest is to probably write a mapping for the Color class and use a constructor argument:

http://castor.codehaus.org/xml-mapping.html#7.3-Mapping-constructor-arguments

You can also do it with custom field handlers. Please see:

http://castor.codehaus.org/xml-fieldhandlers.html

You can even register a FieldHandlerFactory with the introspector (though it's not really documented much - you can search on FieldHandlerFactory in the mailing list and you should find an example).

Hope that helps,

--Keith


Samuel Sanchez wrote:
Hi all,

I've a class that has a java.awt.Color attribute.
When marhaling the class there's no problem, but when trying to unmarshal the resulting XML file Castor throws a MappingException.

I think that it's because java.awt.Color has no empty constructor (public void Color()) nor public static Object newInstance() method, so Castor can not create a new class when unmarshaling.. am I right?

Is there any way to manage that kind of attributes (java.awt.Color like) with Castor?

Thanks a lot.


-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to