public class JaxbUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
marshal(JAXBContext jaxbContext,
Object object,
String mediaType)
marshalls object instance to String
|
static <T> T |
unmarshal(JAXBContext jaxbContext,
Source source,
Class<T> type,
String mediaType)
unmarshalls object instance from Source
|
static <T> T |
unmarshal(JAXBContext jaxbContext,
String string,
Class<T> type,
String mediaType)
unmarshalls object instance from String
|
static <T> List<T> |
unmarshalCollection(JAXBContext jaxbContext,
Source source,
Class<T> type,
String mediaType)
unmarshalls collection of object instances
|
public static <T> T unmarshal(JAXBContext jaxbContext, String string, Class<T> type, String mediaType)
T - jaxbContext - string - source xml/jsontype - deserved type (null - autodetect)mediaType - public static <T> T unmarshal(JAXBContext jaxbContext, Source source, Class<T> type, String mediaType)
T - jaxbContext - source - example from String: new StreamSource(new
java.io.StringReader(string)), from InputStream: new StreamSource(is)type - deserved type (null - autodetect)mediaType - application/json or application/xmlpublic static String marshal(JAXBContext jaxbContext, Object object, String mediaType)
jaxbContext - object - object to be marshalledmediaType - application/json or application/xmlpublic static <T> List<T> unmarshalCollection(JAXBContext jaxbContext, Source source, Class<T> type, String mediaType)
T - jaxbContext - source - example from String: new StreamSource(new
java.io.StringReader(string)), from InputStream: new StreamSource(is)type - mediaType - Copyright © 2019. All rights reserved.