public class SpincastXmlManager extends Object implements IXmlManager
| Constructor and Description |
|---|
SpincastXmlManager(com.google.inject.Provider<com.google.inject.Injector> guiceProvider,
IJsonManager jsonManager,
Set<IXmlMixinInfo> xmlMixinInfos,
com.fasterxml.jackson.dataformat.xml.XmlPrettyPrinter xmlPrettyPrinter) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configureEmptyBeans(com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper) |
protected void |
configureMixins(com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper) |
protected void |
configureXmlMapper(com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper)
Configuration of the XmlMapper.
|
protected com.fasterxml.jackson.dataformat.xml.XmlMapper |
createXmlMapper()
Creates the XmlMapper
|
protected IJsonArray |
deserializeJsonArray(com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser xmlParser,
com.fasterxml.jackson.databind.DeserializationContext context) |
protected IJsonArray |
deserializeJsonArray(com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser xmlParser,
com.fasterxml.jackson.databind.DeserializationContext context,
boolean firstElementSkipped) |
protected IJsonObject |
deserializeJsonObject(com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser xmlParser,
com.fasterxml.jackson.databind.DeserializationContext context,
Map.Entry<String,Object> firstProperty) |
protected Object |
deserializeObjectOrArray(com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser xmlParser,
com.fasterxml.jackson.databind.DeserializationContext context) |
IJsonObject |
fromXml(String xml)
Deserializes a XML to an
IJsonObject. |
<T> T |
fromXml(String xml,
Class<T> clazz)
Deserializes a XML to the given Class.
|
<T> T |
fromXmlInputStream(InputStream inputStream,
Class<T> clazz)
Deserializes a XML inputstream to the given Type.
|
IJsonArray |
fromXmlToJsonArray(String xml)
Deserializes a XML to an
IJsonArray. |
<T> T |
fromXmlToType(String xml,
Type type)
Deserializes a XML to the given Type.
|
protected String |
getArrayAttributeName()
The name of the attribute set on a XML element to indicate it
comes from a IJsonArray.
|
protected com.google.inject.Injector |
getGuice() |
protected com.fasterxml.jackson.databind.JsonDeserializer<IJsonArray> |
getJsonArrayDeserializer() |
protected com.fasterxml.jackson.databind.JsonSerializer<IJsonArray> |
getJsonArraySerializer() |
protected IJsonManager |
getJsonManager() |
protected com.fasterxml.jackson.databind.JsonDeserializer<IJsonObject> |
getJsonObjectDeserializer() |
protected com.fasterxml.jackson.databind.JsonSerializer<IJsonObject> |
getJsonObjectSerializer() |
protected com.fasterxml.jackson.dataformat.xml.XmlMapper |
getXmlMapper() |
protected com.fasterxml.jackson.dataformat.xml.XmlMapper |
getXmlMapperPretty() |
protected Set<IXmlMixinInfo> |
getXmlMixinInfos() |
protected com.fasterxml.jackson.dataformat.xml.XmlPrettyPrinter |
getXmlPrettyPrinter() |
protected void |
injectDependencies(Object obj)
Once the deserialization of an Object is done,
we inject dependencies using Guice.
|
protected void |
registerCustomModules(com.fasterxml.jackson.dataformat.xml.XmlMapper objectMapper) |
protected void |
registerIJsonObjectModule(com.fasterxml.jackson.dataformat.xml.XmlMapper objectMapper)
Register our custom (de)serializers for IJsonObject
|
String |
toXml(Object obj)
Converts an object to XML.
|
String |
toXml(Object obj,
boolean pretty)
Converts an object to XML.
|
@Inject
public SpincastXmlManager(com.google.inject.Provider<com.google.inject.Injector> guiceProvider,
IJsonManager jsonManager,
@Nullable
Set<IXmlMixinInfo> xmlMixinInfos,
com.fasterxml.jackson.dataformat.xml.XmlPrettyPrinter xmlPrettyPrinter)
protected com.google.inject.Injector getGuice()
protected IJsonManager getJsonManager()
protected Set<IXmlMixinInfo> getXmlMixinInfos()
protected com.fasterxml.jackson.dataformat.xml.XmlPrettyPrinter getXmlPrettyPrinter()
protected com.fasterxml.jackson.dataformat.xml.XmlMapper getXmlMapper()
protected com.fasterxml.jackson.dataformat.xml.XmlMapper createXmlMapper()
protected void configureXmlMapper(com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper)
protected void configureEmptyBeans(com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper)
protected void configureMixins(com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper)
protected com.fasterxml.jackson.dataformat.xml.XmlMapper getXmlMapperPretty()
protected String getArrayAttributeName()
protected com.fasterxml.jackson.databind.JsonSerializer<IJsonObject> getJsonObjectSerializer()
protected com.fasterxml.jackson.databind.JsonSerializer<IJsonArray> getJsonArraySerializer()
protected com.fasterxml.jackson.databind.JsonDeserializer<IJsonObject> getJsonObjectDeserializer()
protected com.fasterxml.jackson.databind.JsonDeserializer<IJsonArray> getJsonArrayDeserializer()
protected Object deserializeObjectOrArray(com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser xmlParser, com.fasterxml.jackson.databind.DeserializationContext context)
protected IJsonArray deserializeJsonArray(com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser xmlParser, com.fasterxml.jackson.databind.DeserializationContext context)
protected IJsonArray deserializeJsonArray(com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser xmlParser, com.fasterxml.jackson.databind.DeserializationContext context, boolean firstElementSkipped)
protected IJsonObject deserializeJsonObject(com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser xmlParser, com.fasterxml.jackson.databind.DeserializationContext context, Map.Entry<String,Object> firstProperty)
protected void registerCustomModules(com.fasterxml.jackson.dataformat.xml.XmlMapper objectMapper)
protected void registerIJsonObjectModule(com.fasterxml.jackson.dataformat.xml.XmlMapper objectMapper)
public String toXml(Object obj)
IXmlManagerIJsonObject, its elements
of type "IJsonArray" will have a "isArray='true'" attribute
added. This way, the XML can be deserialized back to a
IJsonObject correctly.toXml in interface IXmlManagerpublic String toXml(Object obj, boolean pretty)
IXmlManagertoXml in interface IXmlManagerpretty - If true, the generated XML will
be formatted.public IJsonObject fromXml(String xml)
IXmlManagerIJsonObject. This
will correctly manage the XML generated by
toXml(), arrays included.fromXml in interface IXmlManagerpublic IJsonArray fromXmlToJsonArray(String xml)
IXmlManagerIJsonArray. This
will correctly manage the XML generated by
toXml(), arrays included.fromXmlToJsonArray in interface IXmlManagerpublic <T> T fromXml(String xml, Class<T> clazz)
IXmlManagerIJsonObject to get the
arrays to work out of the box!fromXml in interface IXmlManagerprotected void injectDependencies(Object obj)
public <T> T fromXmlToType(String xml, Type type)
IXmlManagerIJsonObject to get the
arrays to work out of the box!fromXmlToType in interface IXmlManagerpublic <T> T fromXmlInputStream(InputStream inputStream, Class<T> clazz)
IXmlManagerIJsonObject to get the
arrays to work out of the box!fromXmlInputStream in interface IXmlManagerCopyright © 2016. All rights reserved.