Here you can find the source of deserialize(Class
public static <T> T deserialize(Class<T> clazz, String filename) throws JAXBException
//package com.java2s; //License from project: LGPL import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; public class Main { public static <T> T deserialize(Class<T> clazz, String filename) throws JAXBException { File file = new File(filename); JAXBContext jaxbContext = JAXBContext.newInstance(clazz); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); T t = (T) jaxbUnmarshaller.unmarshal(file); return t; }//from w w w .ja va 2 s . c o m }