Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jersey.api.json
Interface JSONMarshaller

    public interface JSONMarshaller

A JSON marshaller responsible for serializing Java content trees, defined by JAXB, to JSON data.

Author:
  Jakub.Podlesak@Sun.COM, Paul.Sandoz@Sun.COM

Field Summary
`static java.lang.String` | `FORMATTED`

Method Summary
`void` | `marshallToJSON(java.lang.Object jaxbElement, java.io.OutputStream os)` Marshall the content tree rooted at `jaxbElement` into an output stream.
`void` | `marshallToJSON(java.lang.Object jaxbElement, java.io.Writer writer)` Marshall the content tree rooted at `jaxbElement` into an output stream.
`void` | `setProperty(java.lang.String name, java.lang.Object value)` Set the particular property in the underlying implementation of `JSONMarshaller`.

Field Detail

### FORMATTED

    static final java.lang.String FORMATTED

See Also:
  Constant Field Values

Method Detail

### marshallToJSON

    void marshallToJSON(java.lang.Object jaxbElement,
                        java.io.OutputStream os)
                        throws javax.xml.bind.JAXBException

  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.

  Parameters:
    `jaxbElement` - the root of the content tree to be marshalled.
    `os` - the JSON will be added to this stream.
  Throws:
    `javax.xml.bind.JAXBException` - if any unexpected problem occurs during the marshalling.
    `javax.xml.bind.MarshalException` - if the `JSONMarshaller` is unable to marshal `jaxbElement` (or any object reachable from obj)
    `java.lang.IllegalArgumentException` - if any of the method parameters are null.

### marshallToJSON

    void marshallToJSON(java.lang.Object jaxbElement,
                        java.io.Writer writer)
                        throws javax.xml.bind.JAXBException

  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.

  Parameters:
    `jaxbElement` - the root of the content tree to be marshalled.
    `writer` - the JSON will be added to this writer.
  Throws:
    `javax.xml.bind.JAXBException` - if any unexpected problem occurs during the marshalling.
    `javax.xml.bind.MarshalException` - if the `JSONMarshaller` is unable to marshal `jaxbElement` (or any object reachable from obj)
    `java.lang.IllegalArgumentException` - If any of the method parameters are null.

### setProperty

    void setProperty(java.lang.String name,
                     java.lang.Object value)
                     throws javax.xml.bind.PropertyException

  Set the particular property in the underlying implementation of `JSONMarshaller`. Attempting to set an undefined property will result in a PropertyException being thrown.

  Parameters:
    `name` - 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:
    `javax.xml.bind.PropertyException` - when there is an error processing the given property or value
    `java.lang.IllegalArgumentException` - If the name parameter is null

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2013 Oracle Corporation. All Rights Reserved.