|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.xml.bind.JAXBContext
com.sun.jersey.api.json.JSONJAXBContext
public final class JSONJAXBContext
JSONJAXBContext is a configurable JAXBContext wrapper. It allows serialization and deserialization of JAXB beans to and from JSON format. Configuration is done by providing a set of properties to the JSONJAXBContext constructor. The properties could be also set directly on Marshaller/Unmarshaller created by the context.
Nested Class Summary | |
---|---|
static class |
JSONJAXBContext.JSONNotation
|
Field Summary | |
---|---|
static java.lang.String |
JSON_ARRAYS
Expects a list of names in JSON format, which represent arrays, and should be treated as arrays even if they contain just one single element. |
static java.lang.String |
JSON_ENABLED
If set to true, JSON will be serialized/deserialized instead of XML |
static java.lang.String |
JSON_NON_STRINGS
Expects a list of names in JSON format, which represent non-string values (such as numbers), and should be serialized out without surrounding double quotes I.e. |
static java.lang.String |
JSON_NOTATION
Expects a String corresponding to desired JSON notation. |
static java.lang.String |
JSON_ROOT_UNWRAPPING
If set to true, JSON code corresponding to the XML root element will be stripped out for MAPPED (default) notation. |
static java.lang.String |
JSON_XML2JSON_NS
Via this property you can configure namespaces mapping used by MAPPED_JETTISON notation. |
static java.lang.String |
NAMESPACE
A namespace for JSONJAXBContext related properties names. |
Fields inherited from class javax.xml.bind.JAXBContext |
---|
JAXB_CONTEXT_FACTORY |
Constructor Summary | |
---|---|
JSONJAXBContext(java.lang.Class... classesToBeBound)
Constructs a new JSONJAXBContext with default properties. |
|
JSONJAXBContext(java.lang.Class[] classesToBeBound,
java.util.Map<java.lang.String,java.lang.Object> properties)
Constructs a new JSONJAXBContext with a custom set of properties. |
Method Summary | |
---|---|
javax.xml.bind.Marshaller |
createMarshaller()
Overrides underlaying createMarshaller method and returns a marshaller which is capable of JSON serialization. |
javax.xml.bind.Unmarshaller |
createUnmarshaller()
Overrides underlaying createUnmarshaller method and returns an unmarshaller which is capable of JSON deserialization. |
javax.xml.bind.Validator |
createValidator()
Simply delegates to underlying JAXBContext implementation. |
Methods inherited from class javax.xml.bind.JAXBContext |
---|
createBinder, createBinder, createJAXBIntrospector, generateSchema, newInstance, newInstance, newInstance, newInstance, newInstance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NAMESPACE
public static final java.lang.String JSON_NOTATION
"MAPPED"
, "MAPPED_JETTISON"
and "BADGERFISH"
public static final java.lang.String JSON_ENABLED
public static final java.lang.String JSON_ROOT_UNWRAPPING
public static final java.lang.String JSON_ARRAYS
{ ..., "arr1":["single element"], ... }
would be
serialized as { ..., "arr1":"single element", ... }
,
if JSON_ARRAYS
was not set to "[\"arr1\"]"
Related to MAPPED notation only.
public static final java.lang.String JSON_NON_STRINGS
{ ..., "anumber":12, ... }
would be
serialized as { ..., "anumber":"12", ... }
,
if JSON_NON_STRINGS
was not set to "[\"anumber\"]"
Related to MAPPED notation only.
public static final java.lang.String JSON_XML2JSON_NS
Constructor Detail |
---|
public JSONJAXBContext(java.lang.Class... classesToBeBound) throws javax.xml.bind.JAXBException
classesToBeBound
-
javax.xml.bind.JAXBException
public JSONJAXBContext(java.lang.Class[] classesToBeBound, java.util.Map<java.lang.String,java.lang.Object> properties) throws javax.xml.bind.JAXBException
classesToBeBound
-
javax.xml.bind.JAXBException
Method Detail |
---|
public javax.xml.bind.Unmarshaller createUnmarshaller() throws javax.xml.bind.JAXBException
createUnmarshaller
in class javax.xml.bind.JAXBContext
javax.xml.bind.JAXBException
public javax.xml.bind.Marshaller createMarshaller() throws javax.xml.bind.JAXBException
createMarshaller
in class javax.xml.bind.JAXBContext
javax.xml.bind.JAXBException
public javax.xml.bind.Validator createValidator() throws javax.xml.bind.JAXBException
createValidator
in class javax.xml.bind.JAXBContext
javax.xml.bind.JAXBException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |