Get “Class” object from generic type T

后端 未结 6 1788

I want to make generic function that return Object representation of XML document (using JAXB). I need to pass \"class\" object to JAXBContext constructor, but how I can get it

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-19 16:59

    try to pass the class itself, something like this

    public  readXmlToObject(String xmlFileName, Class class) {
    

提交回复
热议问题