Jaxb の新機能です。オブジェクト ファクトリに 1 つ疑問があります。疑問は、オブジェクト ファクトリクラスのcreateXXXBeanメソッドで、UnMarshall プロセスを呼び出すときに 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);