The Class Mapping API

Version:
  $Revision: 5951 $ $Date: 2003-03-03 00:05:44 -0700 (Mon, 03 Mar 2003) $
Author:
  Assaf Arkin
Author:
  Keith Visco

This package provides a common base for the class mapping descriptors and tools to generate mapping descriptors from a mapping file. The Java objects for the XML-based mapping file are contained in the sub-package `xml` and the DTD and XML schema originate in this package. The sub-package `loader` implements a mapping loader.

{@link org.exolab.castor.mapping.Mapping} serves as a generic mapping loader that can be used to load multiple mapping files and feed them to the XML marshaller, JDO engine, and DAX engine.

{@link org.exolab.castor.mapping.ClassDescriptor} is a mapping descriptor for a Java class, consisting of any number of fields. {@link org.exolab.castor.mapping.FieldDescriptor} is a mapping descriptor for a Java field within that class. Access to the field value is granted through a {@link org.exolab.castor.mapping.FieldHandler}, obtained from the field descriptor.

{@link org.exolab.castor.mapping.MappingResolver} is an interface to a collection of class mapping that can provide the mapping descriptor for a particular Java class. A `MappingResolver` is constructed using a mapping loader, see the `loader` package.

The following example illustrates how to load a mapping file with the current class loader and use it to marshal an object:

      Mapping      map;
      Marshaller   mar;

      // Load the specified mapping file
      map = new Mapping( getClass().getClassLoader() );
      map.loadMapping( "mapping.xml" );

      // Marshal the object into a document
      mar = new Marshaller( output );
      mar.setMapping( mapping );
      mar.marshal( object );