com.sun.jersey.api.json
Interface JSONUnmarshaller


public interface JSONUnmarshaller

A JSON unmarshaller responsible for deserializing JSON data to a Java content tree, defined by JAXB.

Author:
[email protected], [email protected]

Method Summary
<T> T
unmarshalFromJSON(java.io.InputStream is, java.lang.Class<T> expectedType)
          Unmarshal JSON data from the specified InputStream and return the resulting Java content tree.
<T> T
unmarshalFromJSON(java.io.Reader reader, java.lang.Class<T> expectedType)
          Unmarshal JSON data from the specified Reader and return the resulting Java content tree.
<T> javax.xml.bind.JAXBElement<T>
unmarshalJAXBElementFromJSON(java.io.InputStream is, java.lang.Class<T> declaredType)
          Unmarshal JSON data from the InputStream by declaredType and return the resulting content tree.
<T> javax.xml.bind.JAXBElement<T>
unmarshalJAXBElementFromJSON(java.io.Reader reader, java.lang.Class<T> declaredType)
          Unmarshal JSON data from the Reader by declaredType and return the resulting content tree.
 

Method Detail

unmarshalFromJSON

<T> T unmarshalFromJSON(java.io.InputStream is,
                        java.lang.Class<T> expectedType)
                    throws javax.xml.bind.JAXBException
Unmarshal JSON data from the specified InputStream and return the resulting Java content tree.

The UTF-8 character encoding scheme will be used to decode the encoded characters of the JSON data.

Type Parameters:
T - the type of the Java content tree.
Parameters:
is - the InputStream to unmarshal JSON data from.
expectedType - the expected type of the Java content tree.
Returns:
the newly created root object of the Java content tree. The content tree may be an instance of a class that is mapped to a XML root element (for example, annotated with XmlRootElement) or mapped to an XML type (for example, annotated with XmlType).
Throws:
javax.xml.bind.JAXBException - if any unexpected errors occur while unmarshalling.
javax.xml.bind.UnmarshalException - if the JSONUnmarshaller is unable to perform the JSON to Java binding.

unmarshalFromJSON

<T> T unmarshalFromJSON(java.io.Reader reader,
                        java.lang.Class<T> expectedType)
                    throws javax.xml.bind.JAXBException
Unmarshal JSON data from the specified Reader and return the resulting Java content tree.

The character encoding scheme of the reader will be used to encode the characters of the JSON data.

Type Parameters:
T - the type of the Java content tree.
Parameters:
reader - the Reader to unmarshal JSON data from.
expectedType - the expected type of the Java content tree.
Returns:
the newly created root object of the Java content tree. The content tree may be an instance of a class that is mapped to a XML root element (for example, annotated with XmlRootElement) or mapped to an XML type (for example, annotated with XmlType).
Throws:
javax.xml.bind.JAXBException - if any unexpected errors occur while unmarshalling.
javax.xml.bind.UnmarshalException - if the JSONUnmarshaller is unable to perform the JSON to Java binding.

unmarshalJAXBElementFromJSON

<T> javax.xml.bind.JAXBElement<T> unmarshalJAXBElementFromJSON(java.io.InputStream is,
                                                               java.lang.Class<T> declaredType)
                                                           throws javax.xml.bind.JAXBException
Unmarshal JSON data from the InputStream by declaredType and return the resulting content tree.

The UTF-8 character encoding scheme will be used to decode the encoded characters of the JSON data.

Type Parameters:
T - the type of the Java content tree.
Parameters:
is - the InputStream to unmarshal JSON data from.
declaredType - a class that is mapped to a XML root element (for example, annotated with XmlRootElement) or mapped to an XML type (for example, annotated with XmlType).
Returns:
the newly created root object of the Java content tree, root by a JAXBElement instance.
Throws:
javax.xml.bind.JAXBException - if any unexpected errors occur while unmarshalling.
javax.xml.bind.UnmarshalException - if the JSONUnmarshaller is unable to perform the JSON to Java binding.

unmarshalJAXBElementFromJSON

<T> javax.xml.bind.JAXBElement<T> unmarshalJAXBElementFromJSON(java.io.Reader reader,
                                                               java.lang.Class<T> declaredType)
                                                           throws javax.xml.bind.JAXBException
Unmarshal JSON data from the Reader by declaredType and return the resulting content tree.

The character encoding scheme of the reader will be used to encode the characters of the JSON data.

Type Parameters:
T - the type of the Java content tree.
Parameters:
reader - the Reader to unmarshal JSON data from.
declaredType - a class that is mapped to a XML root element (for example, annotated with XmlRootElement) or mapped to an XML type (for example, annotated with XmlType).
Returns:
the newly created root object of the Java content tree, root by a JAXBElement instance.
Throws:
javax.xml.bind.JAXBException - if any unexpected errors occur while unmarshalling.
javax.xml.bind.UnmarshalException - if the JSONUnmarshaller is unable to perform the JSON to Java binding.


Copyright © 2011 Oracle Corporation. All Rights Reserved.