java将在jaxb中创建objectfactory实例
我是Jaxb的新手。我对对象工厂有一个疑问。问题在于,当调用解组过程时,它何时会在objectfactory类createXXXBean方法中创建bean实例。查看下面的objectfactory。createFruitbean()
@XmlElementDecl(namespace = "http://as.com/items/types", name = "fruitbean")
public JAXBElement<Fruittype> createFruitbean(Fruittype value) {
return new JAXBElement<Fruittype>(_Fruitbean_QNAME, Fruittype.class, null, value);
}
请帮帮我
更新:-
我没有得到任何关于上述代码的解释。我对ObjectFactory有怀疑。createFruitBean()。在下面的代码片段中,它将在何处/何时调用方法,即ObjectFactory。createFruitbean()
JAXBContext jContext=JAXBContext.newInstance(ObjectFactory.class);
UnMarshaller unmarshall=jContext.CreateMarshaller();
JAXBElement jElement=unmarshall.UnMarshall(XML_PATH);
# 1 楼答案