public.javadoc.org.spincast.core.xml.XmlManager.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
XmlManager (org.spincast:spincast-framework 1.0.0 API)
org.spincast.core.xml
Interface XmlManager
-
- All Known Implementing Classes:
- SpincastXmlManager
public interface XmlManager
Provides methods to work with XML
strings and objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods
Modifier and Type
Method and Description
JsonObject
fromXml(String xml)
Deserializes a XML to an JsonObject
.
<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.
JsonArray
fromXmlToJsonArray(String xml)
Deserializes a XML to an JsonArray
.
<T> T
fromXmlToType(String xml,
Type type)
Deserializes a XML to the given Type.
String
toXml(Object obj)
Converts an object to XML.
String
toXml(Object obj,
boolean pretty)
Converts an object to XML.
-
-
Method Detail
-
toXml
String toXml(Object obj)
Converts an object to XML.
If the object to convert is a JsonObject
, its elements
of type "JsonArray" will have a "isArray='true'" attribute
added. This way, the XML can be deserialized back to a
JsonObject
correctly.
-
toXml
String toXml(Object obj,
boolean pretty)
Converts an object to XML.
- Parameters:
pretty
- If true
, the generated XML will
be formatted.
-
fromXml
JsonObject fromXml(String xml)
Deserializes a XML to an JsonObject
. This
will correctly manage the XML generated by
toXml(), arrays included.
-
fromXmlToJsonArray
JsonArray fromXmlToJsonArray(String xml)
Deserializes a XML to an JsonArray
. This
will correctly manage the XML generated by
toXml(), arrays included.
-
fromXml
<T> T fromXml(String xml,
Class<T> clazz)
Deserializes a XML to the given Class.
Be aware that if you use a default Type like
Map<String, Object>, the arrays will probably
won't be deserialized correctly. Use the
version returning a JsonObject
to get the
arrays to work out of the box!
-
fromXmlToType
<T> T fromXmlToType(String xml,
Type type)
Deserializes a XML to the given Type.
Be aware that if you use a default Type like
Map<String, Object>, the arrays will probably
won't be deserialized correctly. Use the
version returning a JsonObject
to get the
arrays to work out of the box!
-
fromXmlInputStream
<T> T fromXmlInputStream(InputStream inputStream,
Class<T> clazz)
Deserializes a XML inputstream to the given Type.
Be aware that if you use a default Type like
Map<String, Object>, the arrays will probably
won't be deserialized correctly. Use the
version returning a JsonObject
to get the
arrays to work out of the box!
Copyright © 2019. All rights reserved.