Title: RE: [castor-dev] xml marshalling: dealing with non-javabeans

As a follow-up to that, does Castor use something akin to the jakarta-commons beanutils package to perform the introspection / reflection lookups or does it does it do it directly?

-a

-----Original Message-----
From: Eitan Suez [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 31, 2002 3:09 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] xml marshalling: dealing with non-javabeans


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

Reply via email to