org.globus.wsrf.encoding
Class ObjectDeserializer

java.lang.Object
  extended by org.globus.wsrf.encoding.ObjectDeserializer

public class ObjectDeserializer
extends java.lang.Object

Converts Java DOM Elements and SOAP Elements to Java objects. The objects must be compliant with the Axis Bean model, i.e. generated using the WSDL2Java tool from an XML Schema definition or must be of simple type.


Field Summary
private static org.globus.util.I18n i18n
           
 
Constructor Summary
ObjectDeserializer()
           
 
Method Summary
static boolean contains(javax.xml.soap.SOAPElement element, java.lang.Class javaClass)
          Checks to see whether the any element is of type javaClass.
static java.lang.Object deserialize(org.xml.sax.InputSource input, java.lang.Class javaClass)
          Deserializes input with XML into a Java object of the given type.
static java.lang.Object getFirstAsObject(org.apache.axis.encoding.AnyContentType any)
          Converts the first element of AnyContentType object into a Java object.
static java.lang.Object getFirstAsObject(org.apache.axis.encoding.AnyContentType any, java.lang.Class javaClass)
          Converts the first element of AnyContentType object into a Java object.
static java.lang.Object[] toObject(org.apache.axis.encoding.AnyContentType any)
          Converts a AnyContentType object into a set of Java objects.
static java.lang.Object[] toObject(org.apache.axis.encoding.AnyContentType any, java.lang.Class javaClass)
          Converts a AnyContentType object into a set of Java objects.
static java.lang.Object toObject(org.w3c.dom.Element element)
          Converts a DOM Element object into a Java object.
static java.lang.Object toObject(org.w3c.dom.Element element, java.lang.Class javaClass)
          Converts a DOM Element object into a Java object.
static java.lang.Object toObject(javax.xml.soap.SOAPElement element)
          Converts a SOAPElement object into a Java object.
static java.lang.Object[] toObject(javax.xml.soap.SOAPElement[] elements)
          Converts an array of SOAPElement objects into a set of Java objects.
static java.lang.Object[] toObject(javax.xml.soap.SOAPElement[] elements, java.lang.Class javaClass)
          Converts an array of SOAPElement objects into a set of Java objects.
static java.lang.Object toObject(javax.xml.soap.SOAPElement element, java.lang.Class javaClass)
          Converts a SOAPElement object into a Java object of specified type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

i18n

private static org.globus.util.I18n i18n
Constructor Detail

ObjectDeserializer

public ObjectDeserializer()
Method Detail

toObject

public static java.lang.Object toObject(org.w3c.dom.Element element)
                                 throws DeserializationException
Converts a DOM Element object into a Java object. The type of the Java object will be determined from the xsi:type attribute of the specified element.
Note: This operation is slow as it converts the DOM Element into a string which then is deserialized into a Java object.

Throws:
DeserializationException

toObject

public static java.lang.Object toObject(org.w3c.dom.Element element,
                                        java.lang.Class javaClass)
                                 throws DeserializationException
Converts a DOM Element object into a Java object.
Note: This operation is slow as it converts the DOM Element into a string which then is deserialized into a Java object.

Throws:
DeserializationException

toObject

public static java.lang.Object toObject(javax.xml.soap.SOAPElement element)
                                 throws DeserializationException
Converts a SOAPElement object into a Java object. The type of the Java object will be determined from the xsi:type attribute of the specified element.

Throws:
DeserializationException
See Also:
toObject(SOAPElement, Class)

toObject

public static java.lang.Object toObject(javax.xml.soap.SOAPElement element,
                                        java.lang.Class javaClass)
                                 throws DeserializationException
Converts a SOAPElement object into a Java object of specified type. The class of the object must have been generated from an XML Schema, and thus contain the appropriate meta data to make deserialization possible.

Parameters:
element - SOAPElement to be converted
javaClass - class containing the meta data about how to deserialize the element or a simple Java type such as Integer.
Returns:
Java object that maps to the XML representation of the input. Please note that when the javaClass parameter is specified it is not guaranteed that the deserialized object will be of this type. The input element can have a xsi:type attribute that maps into a different Java type.
Throws:
DeserializationException - if deserialization fails.

toObject

public static java.lang.Object[] toObject(javax.xml.soap.SOAPElement[] elements)
                                   throws DeserializationException
Converts an array of SOAPElement objects into a set of Java objects. The type of the Java object will be determined from the xsi:type attribute of the specified element.

Throws:
DeserializationException
See Also:
toObject(SOAPElement[], Class)

toObject

public static java.lang.Object[] toObject(javax.xml.soap.SOAPElement[] elements,
                                          java.lang.Class javaClass)
                                   throws DeserializationException
Converts an array of SOAPElement objects into a set of Java objects.

Parameters:
elements - an array of elements to convert
javaClass - class containing the meta data about how to deserialize the elements or a simple Java type such as Integer.
Returns:
an array of Java objects (Object[]) that map to the XML representation of the input elements. Please note that when the javaClass parameter is specified it is not guaranteed that the deserialized objects will be of this type or that the objects in the array will be of the same type. The input elements can have different xsi:type attribute that could map into different Java types.
Throws:
DeserializationException - if deserialization fails.

toObject

public static java.lang.Object[] toObject(org.apache.axis.encoding.AnyContentType any)
                                   throws DeserializationException
Converts a AnyContentType object into a set of Java objects. The type of the Java object will be determined from the xsi:type attribute of the specified element.

Throws:
DeserializationException
See Also:
toObject(SOAPElement[], Class)

toObject

public static java.lang.Object[] toObject(org.apache.axis.encoding.AnyContentType any,
                                          java.lang.Class javaClass)
                                   throws DeserializationException
Converts a AnyContentType object into a set of Java objects.

Throws:
DeserializationException
See Also:
toObject(SOAPElement[], Class)

getFirstAsObject

public static java.lang.Object getFirstAsObject(org.apache.axis.encoding.AnyContentType any)
                                         throws DeserializationException
Converts the first element of AnyContentType object into a Java object. The type of the Java object will be determined from the xsi:type attribute of the specified element.

Throws:
DeserializationException
See Also:
toObject(SOAPElement, Class)

getFirstAsObject

public static java.lang.Object getFirstAsObject(org.apache.axis.encoding.AnyContentType any,
                                                java.lang.Class javaClass)
                                         throws DeserializationException
Converts the first element of AnyContentType object into a Java object.

Throws:
DeserializationException
See Also:
toObject(SOAPElement, Class)

contains

public static boolean contains(javax.xml.soap.SOAPElement element,
                               java.lang.Class javaClass)
Checks to see whether the any element is of type javaClass. The javaClass must be generated from an XML Schema representation. This operation could be seen as the instanceof equivalent for xsd:any types


deserialize

public static java.lang.Object deserialize(org.xml.sax.InputSource input,
                                           java.lang.Class javaClass)
                                    throws DeserializationException
Deserializes input with XML into a Java object of the given type.

Throws:
DeserializationException