Hi Keith,
I applied your workaround and it did work with a strange behaviour.

        FieldHandlerFactory factory=new BooleanFHFactory();
        ClassDescriptorResolverImpl cdr = new ClassDescriptorResolverImpl();
        cdr.getIntrospector().addFieldHandlerFactory(factory);
       marshaller.setResolver(cdr);

what is weird is when assigning this resolver implementation to
marshaller the mapping file which i use and assigned to marshaller at
the same time automatically became unused but i could serialize all
boolean fields as 0/1 pair.
Since i need both mapping definitions and this fieldhandler mechanism,
current behaviour cannot help to solve my problem.


what can be the cause of problem? I feel im approaching to finish point...:)


thanks in advance
mesut


On 10/10/05, Mesut Celik <[EMAIL PROTECTED]> wrote:
> On 10/8/05, Keith Visco <[EMAIL PROTECTED]> wrote:
> > Mesut Celik wrote:
> > > hi keith,
> > >
> > > what about the mapping.xml file? Actually I had written an
> > > GeneralizedFieldHandler without handlerFactory and then assigned the
> > > handler to some fields in the mapping file before your mail and it did
> > > not work.
> >
> >
> > How did you specify your handler and what does your handler
> > implementation look like? Did you take a look at the online
> > documentation for writing custom handlers?
> yes i did. I followed online documentation but not heard about
> FieldhandlerFactory on the web site. could you give me an example how
> to create this factory class for boolean types.
>
> >
> > > my question is you did not mention about mapping file in
> > > your mail. dont I have to use mapping file? and what should i do if i
> > > need only some fields to be handled and not the others?
> >
> > Yes you can use a mapping file, which is the normal way to specify
> > custom handlers, but if you wanted to handle all Boolean values in your
> > application the same way then it's easier to write a
> > FieldHandlerFactory. If you only want some values to be handled a
> > certain way, then a mapping file is the better approach.
> >
> again, i wanna handle all boolean values but unable to implement
> FieldHandlerFactory. can you give me more detailed information about
> the methads that need to be implemented in the abstract
> FieldHandlerFactory.
>
> isSupportedType
> getSupportedTypes
> createFieldHandler
>
> spesific explanation for boolean type would be appriciated.
> mesut
>
>
> > --Keith
> >
> > >
> > > thanks in advance,
> > > mesut
> > >
> > > On 10/8/05, Keith Visco <[EMAIL PROTECTED]> wrote:
> > >
> > >>Mesut,
> > >>
> > >>You can write a GeneralizedFieldHandler and a FieldHandlerFactory. The
> > >>FieldHandlerFactory will prevent you from having to specify your
> > >>GeneralizedFieldHandler on every field that is a boolean. You can set
> > >>the FieldHandlerFactory directly on the Introspector as such:
> > >>
> > >>   Marshaller m = new Marshaller(writer);
> > >>   ClassDescriptorResolverImpl cdr = new ClassDescriptorResolverImpl();
> > >>   cdr.getIntrospector().addFieldHandlerFactory(factory);
> > >>   m.setResolver(cdr);
> > >>
> > >>Hope that helps,
> > >>
> > >>--Keith
> > >>
> > >>Mesut Celik wrote:
> > >>
> > >>>Hi all,
> > >>>
> > >>>I wanna serialize boolean values of my objects as 0/1. I think one
> > >>>possible way of doing so is writing Generalized Field handler.
> > >>>Is there any other approach? or what is the best solution for such an 
> > >>>issue?
> > >>>
> > >>>regards,
> > >>>mesut
> > >>>
> > >>>-------------------------------------------------
> > >>>If you wish to unsubscribe from this list, please
> > >>>send an empty message to the following address:
> > >>>
> > >>>[EMAIL PROTECTED]
> > >>>-------------------------------------------------
> > >>>
> > >>>
> > >>
> > >>
> > >>-------------------------------------------------
> > >>If you wish to unsubscribe from this list, please
> > >>send an empty message to the following address:
> > >>
> > >>[EMAIL PROTECTED]
> > >>-------------------------------------------------
> > >>
> > >>
> > >
> > >
> > > -------------------------------------------------
> > > If you wish to unsubscribe from this list, please
> > > send an empty message to the following address:
> > >
> > > [EMAIL PROTECTED]
> > > -------------------------------------------------
> > >
> > >
> >
> >
> > -------------------------------------------------
> > If you wish to unsubscribe from this list, please
> > send an empty message to the following address:
> >
> > [EMAIL PROTECTED]
> > -------------------------------------------------
> >
> >
>

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

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

Reply via email to