Hi Eitan,

You probably want to use org.exolab.castor.mapping.GenericFieldHandler
which removes the specific ties to a given field. It's not hooked into
the MappingLoader yet (an oversight actually) , but it should be pretty
quick to enable it. I'll have it enabled in the CVS today.

--Keith

Eitan Suez wrote:
> 
> hi,
> 
>   xml marshalling question:
> 
>   one of the requirements for default introspection-type marshalling
>   is that your objects follow javabeans conventions.  we all know
>   java.awt.Color is not a javabean and thus has issues with default
>   introspection.
> 
>   i want to custom-marshal any object of this type in my entire
>   model, similar to how dates are marshaled in the castor framework.
> 
>   given a Color, i can marshal it as a string with this operation:
>    Integer.toHexString(color.getRGB());
> 
>   given a parsed color hex value in an xml text node, i can
>   reconstitute the color object with these operations:
> 
>    long rgb = Long.parseLong(colorhexstring);
>    return new Color((int) rgb);
> 
>   Questions:
>       - how do i hook this in to castor?
>       - is there an easy way to do this with castor?
> 
>   i have used fieldhandlers before but they force you to deal with
>   a more specific situation where a color is bound to a specific
>   container -- not the generic case i'm after.  i looked at how dates
>   are handled and there appears to exist custom code for handling
>   dates all over the place.  i don't think this code should go into
>   the castor source tree.  i've actually written a classdescriptor for
>   this type and got the marshalling to work but not the other way
>   around.
> 
> thanks!! / eitan
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to