Class BaseJsonMarshaller
java.lang.Object
org.glassfish.jersey.jettison.internal.BaseJsonMarshaller
- All Implemented Interfaces:
JettisonConfigured,JettisonMarshaller
- Direct Known Subclasses:
JettisonJaxbMarshaller
Base JSON marshaller implementation class.
- Author:
- Jakub Podlesak, Michal Gajdos
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final jakarta.xml.bind.Marshallerprotected JettisonConfigFields inherited from interface org.glassfish.jersey.jettison.JettisonMarshaller
FORMATTED -
Constructor Summary
ConstructorsConstructorDescriptionBaseJsonMarshaller(jakarta.xml.bind.JAXBContext jaxbContext, JettisonConfig jsonConfig) BaseJsonMarshaller(jakarta.xml.bind.Marshaller jaxbMarshaller, JettisonConfig jsonConfig) -
Method Summary
Modifier and TypeMethodDescriptionProvides information on current JSON configuration options for this object.voidmarshallToJSON(Object o, OutputStream outputStream) Marshall the content tree rooted atjaxbElementinto an output stream.voidmarshallToJSON(Object o, Writer writer) Marshall the content tree rooted atjaxbElementinto an output stream.voidsetProperty(String key, Object value) Set the particular property in the underlying implementation ofJettisonMarshaller.
-
Field Details
-
jaxbMarshaller
protected final jakarta.xml.bind.Marshaller jaxbMarshaller -
jsonConfig
-
-
Constructor Details
-
BaseJsonMarshaller
public BaseJsonMarshaller(jakarta.xml.bind.JAXBContext jaxbContext, JettisonConfig jsonConfig) throws jakarta.xml.bind.JAXBException - Throws:
jakarta.xml.bind.JAXBException
-
BaseJsonMarshaller
-
-
Method Details
-
getJSONConfiguration
Description copied from interface:JettisonConfiguredProvides information on current JSON configuration options for this object.- Specified by:
getJSONConfigurationin interfaceJettisonConfigured- Returns:
- a non-null
JettisonConfiginstance.
-
marshallToJSON
public void marshallToJSON(Object o, OutputStream outputStream) throws jakarta.xml.bind.JAXBException Description copied from interface:JettisonMarshallerMarshall the content tree rooted atjaxbElementinto an output stream. The content tree may be an instance of a class that is mapped to a XML root element (for example, annotated withXmlRootElement) or an instance ofJAXBElement.The UTF-8 character encoding scheme will be used to encode the characters of the JSON data.
- Specified by:
marshallToJSONin interfaceJettisonMarshaller- Parameters:
o- the root of the content tree to be marshalled.outputStream- the JSON will be added to this stream.- Throws:
jakarta.xml.bind.JAXBException- if any unexpected problem occurs during the marshalling.jakarta.xml.bind.MarshalException- if theJsonMarshalleris unable to marshaljaxbElement(or any object reachable from obj)
-
marshallToJSON
Description copied from interface:JettisonMarshallerMarshall the content tree rooted atjaxbElementinto an output stream. The content tree may be an instance of a class that is mapped to a XML root element (for example, annotated withXmlRootElement) or an instance ofJAXBElement.The character encoding scheme of the
writerwill be used to encode the characters of the JSON data.- Specified by:
marshallToJSONin interfaceJettisonMarshaller- Parameters:
o- the root of the content tree to be marshalled.writer- the JSON will be added to this writer.- Throws:
jakarta.xml.bind.JAXBException- if any unexpected problem occurs during the marshalling.jakarta.xml.bind.MarshalException- if theJsonMarshalleris unable to marshaljaxbElement(or any object reachable from obj)
-
setProperty
Description copied from interface:JettisonMarshallerSet the particular property in the underlying implementation ofJettisonMarshaller. Attempting to set an undefined property will result in a PropertyException being thrown.- Specified by:
setPropertyin interfaceJettisonMarshaller- Parameters:
key- the name of the property to be set. This value can either be specified using one of the constant fields or a user supplied string.value- the value of the property to be set- Throws:
jakarta.xml.bind.PropertyException- when there is an error processing the given property or value
-