|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.xml.bind.JAXBContext
org.glassfish.jersey.jettison.JettisonJaxbContext
public final class JettisonJaxbContext
An adaption of JAXBContext that supports marshalling
and unmarshalling of JAXB beans using the JSON format.
The JSON format may be configured by using a JettisonConfig object
as a constructor parameter of this class.
| Field Summary |
|---|
| Fields inherited from class javax.xml.bind.JAXBContext |
|---|
JAXB_CONTEXT_FACTORY |
| Constructor Summary | |
|---|---|
JettisonJaxbContext(Class... classesToBeBound)
Constructs a new instance with default JettisonConfig. |
|
JettisonJaxbContext(Class[] classesToBeBound,
Map<String,Object> properties)
Constructs a new instance with a custom set of properties. |
|
JettisonJaxbContext(JettisonConfig config,
Class... classesToBeBound)
Constructs a new instance with given JettisonConfig. |
|
JettisonJaxbContext(JettisonConfig config,
Class[] classesToBeBound,
Map<String,Object> properties)
Constructs a new instance with a custom set of properties. |
|
JettisonJaxbContext(JettisonConfig config,
String contextPath)
Construct a new instance of using context class loader of the thread with given JettisonConfig. |
|
JettisonJaxbContext(JettisonConfig config,
String contextPath,
ClassLoader classLoader,
Map<String,Object> properties)
Construct a new instance using a specified class loader, set of properties and JettisonConfig . |
|
JettisonJaxbContext(String contextPath)
Construct a new instance of using context class loader of the thread with default JettisonConfig. |
|
JettisonJaxbContext(String contextPath,
ClassLoader classLoader)
Construct a new instance using a specified class loader with default JettisonConfig. |
|
JettisonJaxbContext(String contextPath,
ClassLoader classLoader,
Map<String,Object> properties)
Construct a new instance using a specified class loader and a custom set of properties. |
|
| Method Summary | |
|---|---|
JettisonMarshaller |
createJsonMarshaller()
Create a JSON marshaller. |
JettisonUnmarshaller |
createJsonUnmarshaller()
Create a JSON unmarshaller. |
Marshaller |
createMarshaller()
Overrides underlaying createMarshaller method and returns a marshaller which is capable of JSON serialization. |
Unmarshaller |
createUnmarshaller()
Overrides underlying createUnmarshaller method and returns an unmarshaller which is capable of JSON deserialization. |
Validator |
createValidator()
Simply delegates to underlying JAXBContext implementation. |
JettisonConfig |
getJSONConfiguration()
Get the JSON configuration. |
static JettisonMarshaller |
getJSONMarshaller(Marshaller marshaller)
Get a JettisonMarshaller from a Marshaller. |
static JettisonUnmarshaller |
getJSONUnmarshaller(Unmarshaller unmarshaller)
Get a JettisonUnmarshaller from a Unmarshaller. |
| 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 |
| Constructor Detail |
|---|
public JettisonJaxbContext(Class... classesToBeBound)
throws JAXBException
JettisonConfig.
classesToBeBound - list of java classes to be recognized by the
new JsonJaxbContext. Can be empty, in which case a JsonJaxbContext
that only knows about spec-defined classes will be returned.
JAXBException - if an error was encountered while creating the
underlying JAXBContext.
public JettisonJaxbContext(JettisonConfig config,
Class... classesToBeBound)
throws JAXBException
JettisonConfig.
config - JettisonConfig, can not be nullclassesToBeBound - list of java classes to be recognized by the
new JsonJaxbContext. Can be empty, in which case a JsonJaxbContext
that only knows about spec-defined classes will be returned.
JAXBException - if an error was encountered while creating the
underlying JAXBContext.
public JettisonJaxbContext(Class[] classesToBeBound,
Map<String,Object> properties)
throws JAXBException
JettisonConfig is used if no (now deprecated)
JSON related properties are specified
classesToBeBound - list of java classes to be recognized by the
new JsonJaxbContext. Can be empty, in which case a JsonJaxbContext
that only knows about spec-defined classes will be returned.properties - the custom set of properties. If it contains(now deprecated) JSON related properties,
then a non-default JettisonConfig is used reflecting the JSON properties
JAXBException - if an error was encountered while creating the
underlying JAXBContext.
public JettisonJaxbContext(JettisonConfig config,
Class[] classesToBeBound,
Map<String,Object> properties)
throws JAXBException
JettisonConfig.DEFAULT is used as
JettisonConfig
config - JettisonConfig, can not be nullclassesToBeBound - list of java classes to be recognized by the
new JsonJaxbContext. Can be empty, in which case a JsonJaxbContext
that only knows about spec-defined classes will be returned.properties - the custom set of properties.
JAXBException - if an error was encountered while creating the
underlying JAXBContext.
public JettisonJaxbContext(String contextPath)
throws JAXBException
JettisonConfig.
contextPath - list of java package names that contain schema
derived class and/or java to schema (JAXB-annotated) mapped
classes
JAXBException - if an error was encountered while creating the
underlying JAXBContext.
public JettisonJaxbContext(JettisonConfig config,
String contextPath)
throws JAXBException
JettisonConfig.
config - JettisonConfig, can not be nullcontextPath - list of java package names that contain schema
derived class and/or java to schema (JAXB-annotated) mapped
classes
JAXBException - if an error was encountered while creating the
underlying JAXBContext.
public JettisonJaxbContext(String contextPath,
ClassLoader classLoader)
throws JAXBException
JettisonConfig.
contextPath - list of java package names that contain schema
derived class and/or java to schema (JAXB-annotated) mapped
classesclassLoader -
JAXBException - if an error was encountered while creating the
underlying JAXBContext.
public JettisonJaxbContext(String contextPath,
ClassLoader classLoader,
Map<String,Object> properties)
throws JAXBException
JettisonConfig is set to default,
if user does not specify any (now deprecated) JSON related properties
contextPath - list of java package names that contain schema
derived class and/or java to schema (JAXB-annotated) mapped
classesclassLoader - properties - the custom set of properties.
JAXBException - if an error was encountered while creating the
underlying JAXBContext.
public JettisonJaxbContext(JettisonConfig config,
String contextPath,
ClassLoader classLoader,
Map<String,Object> properties)
throws JAXBException
JettisonConfig .
config - JettisonConfig, can not be nullcontextPath - list of java package names that contain schema
derived class and/or java to schema (JAXB-annotated) mapped
classesclassLoader - properties - the custom set of properties.
JAXBException - if an error was encountered while creating the
underlying JAXBContext.| Method Detail |
|---|
public static JettisonMarshaller getJSONMarshaller(Marshaller marshaller)
JettisonMarshaller from a Marshaller.
marshaller - the JAXB marshaller.
public static JettisonUnmarshaller getJSONUnmarshaller(Unmarshaller unmarshaller)
JettisonUnmarshaller from a Unmarshaller.
unmarshaller - the JAXB unmarshaller.
public JettisonConfig getJSONConfiguration()
getJSONConfiguration in interface JettisonConfigured
public JettisonUnmarshaller createJsonUnmarshaller()
throws JAXBException
JAXBException - if there is an error creating the unmarshaller.
public JettisonMarshaller createJsonMarshaller()
throws JAXBException
JAXBException - if there is an error creating the marshaller.
public Unmarshaller createUnmarshaller()
throws JAXBException
createUnmarshaller in class JAXBContextJAXBException
public Marshaller createMarshaller()
throws JAXBException
createMarshaller in class JAXBContextJAXBException
public Validator createValidator()
throws JAXBException
createValidator in class JAXBContextJAXBException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||