org.scrashmeow.ojb.console
Class CastorUtils

java.lang.Object
  |
  +--org.scrashmeow.ojb.console.CastorUtils

public class CastorUtils
extends java.lang.Object

Defines utility methods for marshalling code generated objects

Author:
Alexander Bibighaus

Constructor Summary
CastorUtils()
           
 
Method Summary
static java.lang.String marshalToString(java.lang.Object obj)
          Marshal an object to a string
static java.lang.Object unmarshalFromFile(java.lang.Class classToLoad, java.io.File fh)
          Unmarshal an an object from a File.
static java.lang.Object unmarshalFromStream(java.lang.Class classToLoad, java.io.InputStream is)
          Unmarshal an an object from a stream.
static java.lang.Object unmarshalFromString(java.lang.Class classToLoad, java.lang.String str)
          Unmarshal an an object from a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CastorUtils

public CastorUtils()
Method Detail

unmarshalFromString

public static java.lang.Object unmarshalFromString(java.lang.Class classToLoad,
                                                   java.lang.String str)
                                            throws org.exolab.castor.xml.ValidationException,
                                                   org.exolab.castor.xml.MarshalException
Unmarshal an an object from a string.

Parameters:
classToLoad - the Class of the object to unmarshal
str - the string containing the serialized object.
Returns:
the object
Throws:
org.exolab.castor.xml.MarshalException - an error occurred unmarshalling
org.exolab.castor.xml.ValidationException - an error occurred while validating the xml

unmarshalFromStream

public static java.lang.Object unmarshalFromStream(java.lang.Class classToLoad,
                                                   java.io.InputStream is)
                                            throws org.exolab.castor.xml.ValidationException,
                                                   org.exolab.castor.xml.MarshalException
Unmarshal an an object from a stream.

Parameters:
classToLoad - the Class of the object to unmarshal
is - the stream containing the serialized object.
Returns:
the object
Throws:
org.exolab.castor.xml.MarshalException - an error occurred unmarshalling
org.exolab.castor.xml.ValidationException - an error occurred while validating the xml

unmarshalFromFile

public static java.lang.Object unmarshalFromFile(java.lang.Class classToLoad,
                                                 java.io.File fh)
                                          throws org.exolab.castor.xml.ValidationException,
                                                 org.exolab.castor.xml.MarshalException,
                                                 java.io.FileNotFoundException
Unmarshal an an object from a File.

Parameters:
classToLoad - the Class of the object to unmarshal
fh - the file containing the serialized object.
Returns:
the object
Throws:
java.io.FileNotFoundException - an error occurred while reading the file
org.exolab.castor.xml.MarshalException - an error occurred unmarshalling
org.exolab.castor.xml.ValidationException - an error occurred while validating the xml

marshalToString

public static java.lang.String marshalToString(java.lang.Object obj)
                                        throws org.exolab.castor.xml.MarshalException,
                                               org.exolab.castor.xml.ValidationException
Marshal an object to a string

Parameters:
obj - the object
Returns:
the serialized object
Throws:
org.exolab.castor.xml.MarshalException - an error occurred marshalling
org.exolab.castor.xml.ValidationException - an error occurred while validating the xml


Copyright © 2003 Alexander Bibighaus et al. All Rights Reserved.