Hi Joe,
You can do a couple things:
1. Use a castor-standard naming convention and place the descriptor in
the
same package as the class that it describes.
For example if you have a class: com.acme.Foo
Then create com.acme.FooDescriptor and castor will find it automatically
for you.
-or-
2. If you wish to place your descriptors some place other than the
package, You can implement (or extend the default one) a
ClassDescriptorResolver which will tell Castor how to find your
descriptors.
--Keith
"Doyle, Joe" wrote:
>
> I need to customize the marshalling of a class, and it sounds like Castor
> lets you do that:
>
> "To use "compile-time" class descriptors, one can either implement the
> org.exolab.castor.xml.XMLClassDescriptor interface for each class which
> needs to be "described", or have the Source Code Generator create the proper
> descriptors."
>
> But it's not clear to me how to add a class derived from XMLClassDescriptor
> to the mapping...can someone fill in the blanks below (or tell me if it's
> possible), so that I can use a mapping that takes most of its marshalling
> info from a XML mapping file but also uses a couple custom ClassDescriptors?
>
> Mapping mapping = new Mapping();
> mapping.loadMapping(args[0]);
>
> // StreetNameAffixDescriptor implements XMLClassDescriptor
> StreetNameAffixDescriptor classDesc = new StreetNameAffixDescriptor();
>
> // now, somehow add classDesc to mapping.
> // Is mapping.getRoot() involved? mapping.getResolver()?
>
> FileWriter file = new FileWriter("pointLocProf.xml");
> Marshaller mar = new Marshaller(file);
>
> mar.setMapping(mapping);
> mar.setSuppressXSIType(true);
> mar.marshal(pointLocProf);
>
> file.close();
>
> -----------------------------------------------------------
> 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