Class BaseJsonMarshaller

    • Field Detail

      • jaxbMarshaller

        protected final jakarta.xml.bind.Marshaller jaxbMarshaller
    • Constructor Detail

      • BaseJsonMarshaller

        public BaseJsonMarshaller​(jakarta.xml.bind.JAXBContext jaxbContext,
                                  JettisonConfig jsonConfig)
                           throws jakarta.xml.bind.JAXBException
        Throws:
        jakarta.xml.bind.JAXBException
      • BaseJsonMarshaller

        public BaseJsonMarshaller​(jakarta.xml.bind.Marshaller jaxbMarshaller,
                                  JettisonConfig jsonConfig)
    • Method Detail

      • marshallToJSON

        public void marshallToJSON​(Object o,
                                   OutputStream outputStream)
                            throws jakarta.xml.bind.JAXBException
        Description copied from interface: JettisonMarshaller
        Marshall the content tree rooted at jaxbElement into an output stream. The content tree may be an instance of a class that is mapped to a XML root element (for example, annotated with XmlRootElement) or an instance of JAXBElement.

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

        Specified by:
        marshallToJSON in interface JettisonMarshaller
        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 the JsonMarshaller is unable to marshal jaxbElement (or any object reachable from obj)
      • marshallToJSON

        public void marshallToJSON​(Object o,
                                   Writer writer)
                            throws jakarta.xml.bind.JAXBException
        Description copied from interface: JettisonMarshaller
        Marshall the content tree rooted at jaxbElement into an output stream. The content tree may be an instance of a class that is mapped to a XML root element (for example, annotated with XmlRootElement) or an instance of JAXBElement.

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

        Specified by:
        marshallToJSON in interface JettisonMarshaller
        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 the JsonMarshaller is unable to marshal jaxbElement (or any object reachable from obj)
      • setProperty

        public void setProperty​(String key,
                                Object value)
                         throws jakarta.xml.bind.PropertyException
        Description copied from interface: JettisonMarshaller
        Set the particular property in the underlying implementation of JettisonMarshaller. Attempting to set an undefined property will result in a PropertyException being thrown.
        Specified by:
        setProperty in interface JettisonMarshaller
        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