我正在尝试使用DynamicEntity解组一些简单的JSON,并且它完全在我身上轰炸。文档相当稀少,甚至可以做到这一点?我基本上是这样做的;带JSON的MOXy DynamicEntity?
JAXBContext jaxbContext = JAXBContext.newInstance(DynamicEntity.class);
DynamicEntity entity = (DynamicEntity) jaxbContext.createUnmarshaller().unmarshal(entityStream);
这是直接从XML文档在这里:https://wiki.eclipse.org/EclipseLink/Examples/MOXy/Dynamic/XmlToDynamicEntity
我也得到; 产生的原因:
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
org.eclipse.persistence.dynamic.DynamicEntity is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at org.eclipse.persistence.dynamic.DynamicEntity
有没有人成功地得到这个工作?我基本上试图避免构建POJO,因为我的后端存储不管它们,我只是想反序列化为一个通用对象并传递给它。在.NET中,我只是使用dynamic
,但我非常难以理解如何使用Moxy做到这一点。