public final class XmlSerialiser extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> List<T> |
collectionFromXml(Class<T> type,
InputStream source)
Converts the contents of the InputStream to a List with objects of the
given class.
|
static <T> List<T> |
collectionFromXml(Class<T> type,
Reader source)
Converts the contents of the Reader to a List with objects of the given
class.
|
static <T> List<T> |
collectionFromXml(Class<T> type,
Source source)
Converts the contents of the Source to a List with objects of the given
class.
|
static <T> List<T> |
collectionFromXml(Class<T> type,
String source)
Converts the contents of the string to a List with objects of the given
class.
|
protected static <T> JAXBElement<?> |
createCollectionElement(String rootName,
Collection<T> c)
Create a JAXBElement containing a JAXBCollection.
|
protected static <T> Class<?>[] |
findTypes(Collection<T> c)
Discovers all the classes in the given Collection.
|
static <T> String |
schema(T obj) |
static <T> void |
schema(T obj,
OutputStream schemaDest) |
static <T> void |
schema(T obj,
Writer schemaDest) |
static <T> String |
toXml(String rootName,
Collection<T> c,
boolean format,
boolean fragment)
Convert a collection to a string.
|
static <T> void |
toXml(String rootName,
Collection<T> c,
File f,
boolean format,
boolean fragment)
Convert a collection to a string and stores it in a File.
|
static <T> void |
toXml(String rootName,
Collection<T> c,
OutputStream dest,
boolean format,
boolean fragment)
Convert a collection to a string and sends it to the OutputStream.
|
static <T> void |
toXml(String rootName,
Collection<T> c,
Writer w,
boolean format,
boolean fragment)
Convert a collection to a string and sends it to the Writer.
|
static <T> String |
toXml(T obj,
boolean format,
boolean fragment)
Convert an object to a string.
|
static <T> void |
toXml(T obj,
File f,
boolean format,
boolean fragment)
Convert an object to a string and save it to a File.
|
static <T> void |
toXml(T obj,
OutputStream source,
boolean format,
boolean fragment)
Convert an object to a string and send it to an OutputStream.
|
static <T> void |
toXml(T obj,
Writer wr,
boolean format,
boolean fragment)
Convert an object to a string and send it to a Writer.
|
static <T> void |
toXml(T obj,
XMLStreamWriter wr,
boolean format,
boolean fragment)
Convert an object to a string and send it to a Writer.
|
static <T,C> C |
typeFromXml(Class<T> type,
File source)
Convert the contents of a file to an object of a given class.
|
static <T,C> C |
typeFromXml(Class<T> type,
InputStream source)
Convert the contents of an InputStream to an object of a given class.
|
static <T,C> C |
typeFromXml(Class<T> type,
Reader source)
Convert the contents of a Reader to an object of a given class.
|
static <T,C> C |
typeFromXml(Class<T> type,
Source source)
Convert the contents of a Source to an object of a given class.
|
static <T,C> C |
typeFromXml(Class<T> type,
String source)
Convert a string to an object of a given class.
|
public static <T,C> C typeFromXml(Class<T> type, String source) throws JAXBException
type - Type of objectsource - Input stringJAXBExceptionpublic static <T,C> C typeFromXml(Class<T> type, File source) throws JAXBException
type - Type of objectsource - File to be readJAXBExceptionpublic static <T,C> C typeFromXml(Class<T> type, Reader source) throws JAXBException
type - Type of objectsource - Reader to be readJAXBExceptionpublic static <T,C> C typeFromXml(Class<T> type, InputStream source) throws JAXBException
type - Type of objectsource - InputStream to be readJAXBExceptionpublic static <T,C> C typeFromXml(Class<T> type, Source source) throws JAXBException
type - Type of objectsource - Source to be usedJAXBExceptionpublic static <T> List<T> collectionFromXml(Class<T> type, String source) throws JAXBException
type - Type to be usedsource - Input stringJAXBExceptionpublic static <T> List<T> collectionFromXml(Class<T> type, Reader source) throws JAXBException
type - Type to be usedsource - InputJAXBExceptionpublic static <T> List<T> collectionFromXml(Class<T> type, InputStream source) throws JAXBException
type - Type to be usedsource - InputJAXBExceptionpublic static <T> List<T> collectionFromXml(Class<T> type, Source source) throws JAXBException
type - Type to be usedsource - InputJAXBExceptionpublic static <T> String toXml(T obj, boolean format, boolean fragment) throws JAXBException
obj - Object that needs to be serialized / marshalled.JAXBExceptionpublic static <T> void toXml(T obj,
Writer wr,
boolean format,
boolean fragment)
throws JAXBException
obj - Object that needs to be serialized / marshalledwr - Writer used for outputting the marshalled objectJAXBExceptionpublic static <T> void toXml(T obj,
XMLStreamWriter wr,
boolean format,
boolean fragment)
throws JAXBException
obj - Object that needs to be serialized / marshalledwr - Writer used for outputting the marshalled objectJAXBExceptionpublic static <T> void toXml(T obj,
File f,
boolean format,
boolean fragment)
throws JAXBException
obj - Object that needs to be serialized / marshalledf - Save fileJAXBExceptionpublic static <T> void toXml(T obj,
OutputStream source,
boolean format,
boolean fragment)
throws JAXBException
obj - Object that needs to be serialized / marshalledsource - Stream used for outputJAXBExceptionpublic static <T> String toXml(String rootName, Collection<T> c, boolean format, boolean fragment) throws JAXBException
rootName - Name of the XML root elementc - Collection that needs to be marshalledJAXBExceptionpublic static <T> void toXml(String rootName, Collection<T> c, Writer w, boolean format, boolean fragment) throws JAXBException
rootName - Name of the XML root elementc - Collection that needs to be marshalledw - OutputJAXBExceptionpublic static <T> void toXml(String rootName, Collection<T> c, File f, boolean format, boolean fragment) throws JAXBException
rootName - Name of the XML root elementc - Collection that needs to be marshalledf - Output fileJAXBExceptionpublic static <T> void toXml(String rootName, Collection<T> c, OutputStream dest, boolean format, boolean fragment) throws JAXBException
rootName - Name of the XML root elementc - Collection that needs to be marshalleddest - OutputJAXBExceptionpublic static <T> void schema(T obj,
Writer schemaDest)
throws IOException,
JAXBException
IOExceptionJAXBExceptionpublic static <T> void schema(T obj,
OutputStream schemaDest)
throws IOException,
JAXBException
IOExceptionJAXBExceptionpublic static <T> String schema(T obj) throws IOException, JAXBException
IOExceptionJAXBExceptionprotected static <T> Class<?>[] findTypes(Collection<T> c)
c - Collection that needs to be scannedprotected static <T> JAXBElement<?> createCollectionElement(String rootName, Collection<T> c)
rootName - Name of the XML root elementc - Copyright © 2015–2018 The veraPDF Consortium. All rights reserved.