Package org.glassfish.jersey.jettison
Interface JettisonUnmarshaller
- All Known Implementing Classes:
BaseJsonUnmarshaller,JettisonJaxbUnmarshaller
public interface JettisonUnmarshaller
A JSON unmarshaller responsible for deserializing JSON data to a Java
content tree, defined by JAXB.
- Author:
- Paul Sandoz, Jakub Podlesak
-
Method Summary
Modifier and TypeMethodDescription<T> TunmarshalFromJSON(InputStream is, Class<T> expectedType) Unmarshal JSON data from the specifiedInputStreamand return the resulting Java content tree.<T> TunmarshalFromJSON(Reader reader, Class<T> expectedType) Unmarshal JSON data from the specifiedReaderand return the resulting Java content tree.<T> jakarta.xml.bind.JAXBElement<T>unmarshalJAXBElementFromJSON(InputStream is, Class<T> declaredType) Unmarshal JSON data from theInputStreambydeclaredTypeand return the resulting content tree.<T> jakarta.xml.bind.JAXBElement<T>unmarshalJAXBElementFromJSON(Reader reader, Class<T> declaredType) Unmarshal JSON data from theReaderbydeclaredTypeand return the resulting content tree.
-
Method Details
-
unmarshalFromJSON
<T> T unmarshalFromJSON(InputStream is, Class<T> expectedType) throws jakarta.xml.bind.JAXBException Unmarshal JSON data from the specifiedInputStreamand 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 withXmlType). - Throws:
jakarta.xml.bind.JAXBException- if any unexpected errors occur while unmarshalling.jakarta.xml.bind.UnmarshalException- if theJsonUnmarshalleris unable to perform the JSON to Java binding.
-
unmarshalFromJSON
Unmarshal JSON data from the specifiedReaderand return the resulting Java content tree.The character encoding scheme of the
readerwill 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 withXmlType). - Throws:
jakarta.xml.bind.JAXBException- if any unexpected errors occur while unmarshalling.jakarta.xml.bind.UnmarshalException- if theJsonUnmarshalleris unable to perform the JSON to Java binding.
-
unmarshalJAXBElementFromJSON
<T> jakarta.xml.bind.JAXBElement<T> unmarshalJAXBElementFromJSON(InputStream is, Class<T> declaredType) throws jakarta.xml.bind.JAXBException Unmarshal JSON data from theInputStreambydeclaredTypeand 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 withXmlRootElement) or mapped to an XML type (for example, annotated withXmlType).- Returns:
- the newly created root object of the Java content tree, root
by a
JAXBElementinstance. - Throws:
jakarta.xml.bind.JAXBException- if any unexpected errors occur while unmarshalling.jakarta.xml.bind.UnmarshalException- if theJsonUnmarshalleris unable to perform the JSON to Java binding.
-
unmarshalJAXBElementFromJSON
<T> jakarta.xml.bind.JAXBElement<T> unmarshalJAXBElementFromJSON(Reader reader, Class<T> declaredType) throws jakarta.xml.bind.JAXBException Unmarshal JSON data from theReaderbydeclaredTypeand return the resulting content tree.The character encoding scheme of the
readerwill 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 withXmlRootElement) or mapped to an XML type (for example, annotated withXmlType).- Returns:
- the newly created root object of the Java content tree, root
by a
JAXBElementinstance. - Throws:
jakarta.xml.bind.JAXBException- if any unexpected errors occur while unmarshalling.jakarta.xml.bind.UnmarshalException- if theJsonUnmarshalleris unable to perform the JSON to Java binding.
-