Keith, I don't understand why adding a FieldHandlerFactory is buried so deep in the API.
Shouldn't we be able to say: unmarshaller.addFieldHandlerFactory( fhf ); One thing I really don't like about the current usage is that we must implement an instance of ClassDescriptorResolverImpl. This makes the user have to know about Castor internal implementation classes and violates the code-to-an-interface paradigm. Jeremy On Thu, 19 Feb 2004 13:49:58 -0600, "Keith Visco" <[EMAIL PROTECTED]> said: > > > Hi Jeremy, > > I'll have to double check against this. I know there is some issues with > java.util.Date, but I thought Calendar could still be overridden with a > GeneralizedFieldHandler. I didn't make any recent changes however to > that code. So the issues you were facing still probably exist. I'll try > out Calendar a bit later and see if I can spot the problem. > > thanks, > > --Keith > > > Jeremy Haile wrote: > > > > Keith, > > > > I tried implementing the FieldHandlerFactory method on the CVS version > > about a month ago with java.util.Calendar, but my field handler was not > > being used (it worked for other types). At the time, we thought that the > > problem was because Castor had some default behavior that could not be > > overridden by a FieldHandlerFactory. Has anything changed since then? > > Should FieldHandlerFactory now work for java.util.Calendar objects? If > > anyone has had success with this, please let me know as I want to use > > FieldHandlerFactory for all of my FieldHandlers... > > > > Thanks, > > Jeremy > > > > PS I haven't upgraded to 0.9.5.3 yet, although I plan to within the > > hour.. *cross fingers* > > > > On Thu, 19 Feb 2004 12:53:02 -0600, "Keith Visco" <[EMAIL PROTECTED]> > > said: > > > > > > > > > Hi Sean, > > > > > > There is currently no built-in support java.util.Calendar. You can > > > probably write a quick GeneralizedFieldHandler that converts the > > > Calendar to a java.util.Date or event a string during marshalling (and > > > back again during unmarshalling). > > > > > > The GeneralizedFieldHandler can be specified in the mapping file such > > > as: > > > > > > mapping.xml > > > <mapping> > > > <class name="com.acme.MyClass" auto-complete="true"> > > > <field name="calendar" type="string" > > > handler="com.acme.MyCalendarFieldHandler"/> > > > </class> > > > </mapping> > > > > > > > > > By using auto-complete="true" this allows you to continue using > > > introspection for all other fields so you don't have to write a complete > > > mapping file. > > > > > > There is also another way in Castor 0.9.5.3 RC1 which is to create a > > > FieldHandlerFactory instance that can return your > > > GeneralizedFieldHandler for all instances of java.util.Calendar during > > > introspection. > > > > > > See this thread for more details on that: > > > > > > http://www.mail-archive.com/castor-dev%40exolab.org/msg16665.html > > > > > > --Keith > > > > > > Sean Leblanc wrote: > > > > > > > > Hello, > > > > > > > > I'm using Castor to marshall some classes I already have. I'm following the > > > > simple way to marshall as outlined here: > > > > > > > > http://www.castor.org/xml-framework.html > > > > > > > > After I worked through the problem of not having changed the > > > > castor.properties files (unmarshalling was failing prior to that) it worked > > > > beautifully. > > > > > > > > However, (java.util.)Calendar items in my classes are NOT being marshalled. > > > > Do I have to create a mapping file in order to do this? Or are there some > > > > settings in the properties file that control this? > > > > > > > > TIA, > > > > > > > > -- > > > > Sean LeBlanc > > > > Software Developer > > > > insightamerica > > > > "Those who do not understand Unix are condemned to reinvent it, poorly." > > > > --Henry Spencer > > > > e-Mail Notice: This communication may contain sensitive information. If you > > > > are not the intended recipient, or believe that you have received this > > > > communication in error, do not print, copy, retransmit, disseminate, or > > > > otherwise use the information contained herein for any purpose. Please > > > > alert the sender that you have received this message in error and delete the > > > > copy that you received. > > > > > > > > ----------------------------------------------------------- > > > > 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 > > > > > -- > > Jeremy Haile > > [EMAIL PROTECTED] > > > > ----------------------------------------------------------- > > 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 > -- Jeremy Haile [EMAIL PROTECTED] ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
