Here you can find the source of unserialize(T component, Class
public static <T> String unserialize(T component, Class<T> returnType)
//package com.java2s; //License from project: Apache License import java.io.StringWriter; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; public class Main { private static JAXBContext JAXBCONTEXT = null; public static <T> String unserialize(T component, Class<T> returnType) { try {//from ww w.j ava2 s.com Marshaller marshaller = JAXBCONTEXT.createMarshaller(); StringWriter sw = new StringWriter(); marshaller.marshal(component, sw); return sw.toString(); } catch (JAXBException je) { return "failed"; } } }