Package org.exolab.castor.mapping

The Class Mapping API

Version:
$Revision: 6216 $ $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.

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.

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

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 );
    
Skip navigation links

Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com