public class XmlMapper extends Object
copy from vipshop VJTools(com.vip.vjtools.vjkit.mapper.XmlMapper) and made some changes.
| 限定符和类型 | 类和说明 |
|---|---|
static class |
XmlMapper.CollectionWrapper
封装Root Element 是 Collection的情况.
|
| 构造器和说明 |
|---|
XmlMapper() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Marshaller |
createMarshaller(Class clazz,
String encoding)
创建Marshaller并设定encoding(可为null).
|
static Unmarshaller |
createUnmarshaller(Class clazz)
创建UnMarshaller.
|
static <T> T |
fromXml(String xml,
Class<T> clazz)
Xml->Java Object.
|
protected static JAXBContext |
getJaxbContext(Class clazz) |
static String |
toXml(Collection<?> root,
String rootName,
Class clazz)
Java Collection->Xml without encoding, 特别支持Root Element是Collection的情形.
|
static String |
toXml(Collection<?> root,
String rootName,
Class clazz,
String encoding)
Java Collection->Xml with encoding, 特别支持Root Element是Collection的情形.
|
static String |
toXml(Object root)
Java Object->Xml without encoding.
|
static String |
toXml(Object root,
Class clazz,
String encoding)
Java Object->Xml with encoding.
|
static String |
toXml(Object root,
String encoding)
Java Object->Xml with encoding.
|
public static String toXml(Object root, Class clazz, String encoding)
public static String toXml(Collection<?> root, String rootName, Class clazz)
public static String toXml(Collection<?> root, String rootName, Class clazz, String encoding)
public static Marshaller createMarshaller(Class clazz, String encoding)
public static Unmarshaller createUnmarshaller(Class clazz)
protected static JAXBContext getJaxbContext(Class clazz)
Copyright © 2019. All rights reserved.