原创

JAXB的继承,解组到封送类的子类

单个类解析:

Reader reader = new StringReader(message);
                Unmarshaller unmarshaller = JAXBContext.newInstance(BaseTransInfoResponse.class).createUnmarshaller();
                BaseTransInfoResponse baseTransInfoResponse = (BaseTransInfoResponse) unmarshaller.unmarshal(reader);

继承关系类解析

Reader reader1 = new StringReader(str);
        Unmarshaller unmarshaller1 = JAXBContext.newInstance(BaseTransInfoResponse.class, ZJJBTransInfoResponse.class).createUnmarshaller();
        ZJJBTransInfoResponse baseTransInfoResponse = (ZJJBTransInfoResponse) unmarshaller1.unmarshal(reader1);


正文到此结束
Loading...