List of usage examples for javax.xml.bind JAXBIntrospector getValue
public static Object getValue(Object jaxbElement)
Get the element value of a JAXB element.
Convenience method to abstract whether working with either a javax.xml.bind.JAXBElement instance or an instance of @XmlRootElement annotated Java class.
From source file:it.cnr.icar.eric.client.ui.common.UIUtility.java
public Object convertToRimBinding(Object uiBindingObj) throws JAXRException { Object rimBindingObj = null;/* w w w.jav a2 s. co m*/ StringWriter sw = new StringWriter(); try { Marshaller marshaller = uiJaxbContext.createMarshaller(); if (uiBindingObj instanceof it.cnr.icar.eric.client.ui.common.conf.bindings.InternationalStringType) { it.cnr.icar.eric.client.ui.common.conf.bindings.ObjectFactory oF = new it.cnr.icar.eric.client.ui.common.conf.bindings.ObjectFactory(); marshaller.marshal(oF.createInternationalString((InternationalStringType) uiBindingObj), sw); Unmarshaller unmarshaller = BindingUtility.getInstance().getJAXBContext().createUnmarshaller(); rimBindingObj = JAXBIntrospector .getValue(unmarshaller.unmarshal(new StreamSource(new StringReader(sw.toString())))); } else { marshaller.marshal(uiBindingObj, sw); Unmarshaller unmarshaller = BindingUtility.getInstance().getJAXBContext().createUnmarshaller(); //unmarshaller.setValidating(true); unmarshaller.setEventHandler(new ValidationEventHandler() { public boolean handleEvent(ValidationEvent event) { boolean keepOn = false; return keepOn; } }); rimBindingObj = unmarshaller.unmarshal(new StreamSource(new StringReader(sw.toString()))); } } catch (JAXBException e) { e.printStackTrace(); throw new JAXRException(e); } return rimBindingObj; }