Class BaseJsonUnmarshaller
java.lang.Object
org.glassfish.jersey.jettison.internal.BaseJsonUnmarshaller
- All Implemented Interfaces:
JettisonConfigured
,JettisonUnmarshaller
- Direct Known Subclasses:
JettisonJaxbUnmarshaller
public class BaseJsonUnmarshaller
extends Object
implements JettisonUnmarshaller, JettisonConfigured
Base JSON marshaller implementation class.
- Author:
- Jakub Podlesak
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final jakarta.xml.bind.Unmarshaller
protected final JettisonConfig
-
Constructor Summary
ConstructorsConstructorDescriptionBaseJsonUnmarshaller
(jakarta.xml.bind.JAXBContext jaxbContext, JettisonConfig jsonConfig) BaseJsonUnmarshaller
(jakarta.xml.bind.Unmarshaller jaxbUnmarshaller, JettisonConfig jsonConfig) -
Method Summary
Modifier and TypeMethodDescriptionProvides information on current JSON configuration options for this object.<T> T
unmarshalFromJSON
(InputStream inputStream, Class<T> expectedType) Unmarshal JSON data from the specifiedInputStream
and return the resulting Java content tree.<T> T
unmarshalFromJSON
(Reader reader, Class<T> expectedType) Unmarshal JSON data from the specifiedReader
and return the resulting Java content tree.<T> jakarta.xml.bind.JAXBElement<T>
unmarshalJAXBElementFromJSON
(InputStream inputStream, Class<T> declaredType) Unmarshal JSON data from theInputStream
bydeclaredType
and return the resulting content tree.<T> jakarta.xml.bind.JAXBElement<T>
unmarshalJAXBElementFromJSON
(Reader reader, Class<T> declaredType) Unmarshal JSON data from theReader
bydeclaredType
and return the resulting content tree.
-
Field Details
-
jaxbUnmarshaller
protected final jakarta.xml.bind.Unmarshaller jaxbUnmarshaller -
jsonConfig
-
-
Constructor Details
-
BaseJsonUnmarshaller
public BaseJsonUnmarshaller(jakarta.xml.bind.JAXBContext jaxbContext, JettisonConfig jsonConfig) throws jakarta.xml.bind.JAXBException - Throws:
jakarta.xml.bind.JAXBException
-
BaseJsonUnmarshaller
public BaseJsonUnmarshaller(jakarta.xml.bind.Unmarshaller jaxbUnmarshaller, JettisonConfig jsonConfig)
-
-
Method Details
-
getJSONConfiguration
Description copied from interface:JettisonConfigured
Provides information on current JSON configuration options for this object.- Specified by:
getJSONConfiguration
in interfaceJettisonConfigured
- Returns:
- a non-null
JettisonConfig
instance.
-
unmarshalFromJSON
public <T> T unmarshalFromJSON(InputStream inputStream, Class<T> expectedType) throws jakarta.xml.bind.JAXBException Description copied from interface:JettisonUnmarshaller
Unmarshal JSON data from the specifiedInputStream
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.
- Specified by:
unmarshalFromJSON
in interfaceJettisonUnmarshaller
- Type Parameters:
T
- the type of the Java content tree.- Parameters:
inputStream
- 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 theJsonUnmarshaller
is unable to perform the JSON to Java binding.
-
unmarshalFromJSON
public <T> T unmarshalFromJSON(Reader reader, Class<T> expectedType) throws jakarta.xml.bind.JAXBException Description copied from interface:JettisonUnmarshaller
Unmarshal JSON data from the specifiedReader
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.- Specified by:
unmarshalFromJSON
in interfaceJettisonUnmarshaller
- 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 theJsonUnmarshaller
is unable to perform the JSON to Java binding.
-
unmarshalJAXBElementFromJSON
public <T> jakarta.xml.bind.JAXBElement<T> unmarshalJAXBElementFromJSON(InputStream inputStream, Class<T> declaredType) throws jakarta.xml.bind.JAXBException Description copied from interface:JettisonUnmarshaller
Unmarshal JSON data from theInputStream
bydeclaredType
and return the resulting content tree.The UTF-8 character encoding scheme will be used to decode the encoded characters of the JSON data.
- Specified by:
unmarshalJAXBElementFromJSON
in interfaceJettisonUnmarshaller
- Type Parameters:
T
- the type of the Java content tree.- Parameters:
inputStream
- 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
JAXBElement
instance. - Throws:
jakarta.xml.bind.JAXBException
- if any unexpected errors occur while unmarshalling.jakarta.xml.bind.UnmarshalException
- if theJsonUnmarshaller
is unable to perform the JSON to Java binding.
-
unmarshalJAXBElementFromJSON
public <T> jakarta.xml.bind.JAXBElement<T> unmarshalJAXBElementFromJSON(Reader reader, Class<T> declaredType) throws jakarta.xml.bind.JAXBException Description copied from interface:JettisonUnmarshaller
Unmarshal JSON data from theReader
bydeclaredType
and return the resulting content tree.The character encoding scheme of the
reader
will be used to encode the characters of the JSON data.- Specified by:
unmarshalJAXBElementFromJSON
in interfaceJettisonUnmarshaller
- 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
JAXBElement
instance. - Throws:
jakarta.xml.bind.JAXBException
- if any unexpected errors occur while unmarshalling.jakarta.xml.bind.UnmarshalException
- if theJsonUnmarshaller
is unable to perform the JSON to Java binding.
-