org.enhydra.zeus
Class Unmarshaller

java.lang.Object
  |
  +--org.enhydra.zeus.Unmarshaller

public class Unmarshaller
extends java.lang.Object

Unmarshaller takes an XML instance document, which should conform to some set of XML constraints, and creates a Java object from the XML document. This object is an instance of the implementation class, which in turn implements the interface, created using an implementation of Generator.

It also assumes that the generated interface and implementation classes are in the classpath, as it will perform a Class.forName on the classes.

Version:
1.0
Author:
Brett McLaughlin, Maciej Zawadzki

Field Summary
static boolean DEBUG
          Constant used to signel whether debug messages should be printed out
protected  java.lang.String namePrefix
          Prefix to be prepended to the name of every generated interface and class.
 
Constructor Summary
Unmarshaller()
           Simple constructor.
 
Method Summary
 java.lang.String getImplClass(java.lang.String interfaceName)
           For the supplied interface name, this will return the current implementation class associated with the interface.
 java.lang.String getJavaPackage()
           Returns the Java package to unmarshall classes to.
 java.lang.String getNamePrefix()
           This method allows the developer to get the prefix that will be prepended to the name of every generated interface and class.
 void setImplClass(java.lang.String interfaceName, java.lang.String implClassName)
           For the supplied interface name, this will allow a customized implementation class to be set.
 void setJavaPackage(java.lang.String javaPackage)
           Sets the Java package to unmarshall classes to.
 void setNamePrefix(java.lang.String namePrefix)
           This method allows the developer to set a prefix that will be prepended to the name of every generated interface and class.
 UnmarshalledObject unmarshal(Source sourceXML)
           This method is the public entry point for unmarshalling an object from an XML instance document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG
Constant used to signel whether debug messages should be printed out

namePrefix

protected java.lang.String namePrefix
Prefix to be prepended to the name of every generated interface and class.
Constructor Detail

Unmarshaller

public Unmarshaller()

Simple constructor.

Method Detail

setImplClass

public void setImplClass(java.lang.String interfaceName,
                         java.lang.String implClassName)

For the supplied interface name, this will allow a customized implementation class to be set. This effectively allows the user to specify their own implementation class to use instead of the default, Zeus-generated class.

Parameters:
interfaceName - String name of interface being deal with.
implClassName - String name of class to load when implementations of interfaceName are needed.

setNamePrefix

public void setNamePrefix(java.lang.String namePrefix)

This method allows the developer to set a prefix that will be prepended to the name of every generated interface and class.

Parameters:
String - prefix that will be prepended to the name of every generated interface and class

getNamePrefix

public java.lang.String getNamePrefix()

This method allows the developer to get the prefix that will be prepended to the name of every generated interface and class. Returns an empty string in the case that a prefix is not prepended.

Returns:
String prefix that will be prepended to the name of every generated interface and class

getImplClass

public java.lang.String getImplClass(java.lang.String interfaceName)

For the supplied interface name, this will return the current implementation class associated with the interface. If no class has been specified, this will return the default, Zeus-generated class name for the interface.

Parameters:
interfaceName - String name of interface being dealt with.
Returns:
String - implementation class for supplied interfaceName.

getJavaPackage

public java.lang.String getJavaPackage()

Returns the Java package to unmarshall classes to.

Returns:
String - the Java package to unmarshall to.

setJavaPackage

public void setJavaPackage(java.lang.String javaPackage)

Sets the Java package to unmarshall classes to.

Parameters:
javaPackage - String the Java package to unmarshall to.

unmarshal

public UnmarshalledObject unmarshal(Source sourceXML)
                             throws java.io.IOException

This method is the public entry point for unmarshalling an object from an XML instance document. Note that the raw converted object is not directly returned, but is available through the UnmarshalledObject.getObject() method on UnmarshalledObject.

XXX: We need to eventually put in Zeus exceptions here, not IOExceptions.

Parameters:
instanceURL - URL for the instance document.
Returns:
UnmarshalledObject - the created Java object, or null if problems occur in a way that does not generate an Exception.
Throws:
IOException - when errors in binding occur.


Copyright © 2001 Enhydra. All Rights Reserved.