java - MOXy DynamicEntity with JSON? -


i'm trying use dynamicentity unmarshal simple json, , it's totally bombing on me. docs rather sparse, possible this? i'm doing this;

jaxbcontext jaxbcontext = jaxbcontext.newinstance(dynamicentity.class); dynamicentity entity = (dynamicentity) jaxbcontext.createunmarshaller().unmarshal(entitystream); 

this straight xml docs here: https://wiki.eclipse.org/eclipselink/examples/moxy/dynamic/xmltodynamicentity

and get; caused by:

com.sun.xml.internal.bind.v2.runtime.illegalannotationsexception: 1 counts of illegalannotationexceptions org.eclipse.persistence.dynamic.dynamicentity interface, , jaxb can't handle interfaces.     problem related following location:         @ org.eclipse.persistence.dynamic.dynamicentity 

has managed work? i'm trying avoid building pojos since backend store doesnt care them anyway, want deserialize generic object , pass along. in .net i'd use dynamic i'm pretty stumped on how moxy.

in order dynamicentity, neccessary use dynamicjaxbcontext. can configured using following in jaxb.properties file:

javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.dynamic.dynamicjaxbcontextfactory 

or can use dynamicjaxbcontextfactory directly.

although dynamic moxy not require java classes bindings (the pojos), need provide binding metadata when creating context. can xsd or binding.xml describes mapping. instead of creating context using jaxbcontext.newinstance(dynamicentity.class), need use alternative methods - see links below.

see example here (using xsd): https://wiki.eclipse.org/eclipselink/examples/moxy/dynamic/jaxbcontextfromxmlschema

or more complex example using binding.xml , json: https://wiki.eclipse.org/eclipselink/examples/moxy/dynamic/flickr


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -