public final class JettisonJaxbContext extends jakarta.xml.bind.JAXBContext implements JettisonConfigured
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.
| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
JettisonMarshaller |
createJsonMarshaller()
Create a JSON marshaller.
|
JettisonUnmarshaller |
createJsonUnmarshaller()
Create a JSON unmarshaller.
|
jakarta.xml.bind.Marshaller |
createMarshaller()
Overrides underlaying createMarshaller method and returns
a marshaller which is capable of JSON serialization.
|
jakarta.xml.bind.Unmarshaller |
createUnmarshaller()
Overrides underlying createUnmarshaller method and returns
an unmarshaller which is capable of JSON deserialization.
|
jakarta.xml.bind.Validator |
createValidator()
Simply delegates to underlying JAXBContext implementation.
|
JettisonConfig |
getJSONConfiguration()
Get the JSON configuration.
|
static JettisonMarshaller |
getJSONMarshaller(jakarta.xml.bind.Marshaller marshaller)
Get a
JettisonMarshaller from a Marshaller. |
static JettisonUnmarshaller |
getJSONUnmarshaller(jakarta.xml.bind.Unmarshaller unmarshaller)
Get a
JettisonUnmarshaller from a Unmarshaller. |
public JettisonJaxbContext(Class... classesToBeBound) throws jakarta.xml.bind.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.jakarta.xml.bind.JAXBException - if an error was encountered while creating the
underlying JAXBContext.public JettisonJaxbContext(JettisonConfig config, Class... classesToBeBound) throws jakarta.xml.bind.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.jakarta.xml.bind.JAXBException - if an error was encountered while creating the
underlying JAXBContext.public JettisonJaxbContext(Class[] classesToBeBound, Map<String,Object> properties) throws jakarta.xml.bind.JAXBException
JettisonConfig is used if no (now deprecated)
JSON related properties are specifiedclassesToBeBound - 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 propertiesjakarta.xml.bind.JAXBException - if an error was encountered while creating the
underlying JAXBContext.public JettisonJaxbContext(JettisonConfig config, Class[] classesToBeBound, Map<String,Object> properties) throws jakarta.xml.bind.JAXBException
JettisonConfig.DEFAULT is used as
JettisonConfigconfig - 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.jakarta.xml.bind.JAXBException - if an error was encountered while creating the
underlying JAXBContext.public JettisonJaxbContext(String contextPath) throws jakarta.xml.bind.JAXBException
JettisonConfig.contextPath - list of java package names that contain schema
derived class and/or java to schema (JAXB-annotated) mapped
classesjakarta.xml.bind.JAXBException - if an error was encountered while creating the
underlying JAXBContext.public JettisonJaxbContext(JettisonConfig config, String contextPath) throws jakarta.xml.bind.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
classesjakarta.xml.bind.JAXBException - if an error was encountered while creating the
underlying JAXBContext.public JettisonJaxbContext(String contextPath, ClassLoader classLoader) throws jakarta.xml.bind.JAXBException
JettisonConfig.contextPath - list of java package names that contain schema
derived class and/or java to schema (JAXB-annotated) mapped
classesclassLoader - jakarta.xml.bind.JAXBException - if an error was encountered while creating the
underlying JAXBContext.public JettisonJaxbContext(String contextPath, ClassLoader classLoader, Map<String,Object> properties) throws jakarta.xml.bind.JAXBException
JettisonConfig is set to default,
if user does not specify any (now deprecated) JSON related propertiescontextPath - 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.jakarta.xml.bind.JAXBException - if an error was encountered while creating the
underlying JAXBContext.public JettisonJaxbContext(JettisonConfig config, String contextPath, ClassLoader classLoader, Map<String,Object> properties) throws jakarta.xml.bind.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.jakarta.xml.bind.JAXBException - if an error was encountered while creating the
underlying JAXBContext.public static JettisonMarshaller getJSONMarshaller(jakarta.xml.bind.Marshaller marshaller)
JettisonMarshaller from a Marshaller.marshaller - the JAXB marshaller.public static JettisonUnmarshaller getJSONUnmarshaller(jakarta.xml.bind.Unmarshaller unmarshaller)
JettisonUnmarshaller from a Unmarshaller.unmarshaller - the JAXB unmarshaller.public JettisonConfig getJSONConfiguration()
getJSONConfiguration in interface JettisonConfiguredpublic JettisonUnmarshaller createJsonUnmarshaller() throws jakarta.xml.bind.JAXBException
jakarta.xml.bind.JAXBException - if there is an error creating the unmarshaller.public JettisonMarshaller createJsonMarshaller() throws jakarta.xml.bind.JAXBException
jakarta.xml.bind.JAXBException - if there is an error creating the marshaller.public jakarta.xml.bind.Unmarshaller createUnmarshaller()
throws jakarta.xml.bind.JAXBException
createUnmarshaller in class jakarta.xml.bind.JAXBContextjakarta.xml.bind.JAXBExceptionpublic jakarta.xml.bind.Marshaller createMarshaller()
throws jakarta.xml.bind.JAXBException
createMarshaller in class jakarta.xml.bind.JAXBContextjakarta.xml.bind.JAXBExceptionpublic jakarta.xml.bind.Validator createValidator()
throws jakarta.xml.bind.JAXBException
createValidator in class jakarta.xml.bind.JAXBContextjakarta.xml.bind.JAXBExceptionCopyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.