public final class JettisonJaxbContext extends 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.
JAXB_CONTEXT_FACTORY
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.
|
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 . |
createBinder, createBinder, createJAXBIntrospector, generateSchema, newInstance, newInstance, newInstance, newInstance, newInstance
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 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 propertiesJAXBException
- 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
classesJAXBException
- 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
classesJAXBException
- 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 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.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.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 JAXBContext
JAXBException
public Marshaller createMarshaller() throws JAXBException
createMarshaller
in class JAXBContext
JAXBException
public Validator createValidator() throws JAXBException
createValidator
in class JAXBContext
JAXBException
Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.