test_class.declarator: log = LoggerFactory.getLogger(JaxbUtilTest.class)
test_class.modifier: private final static
test_class.original_string: private final static Logger log = LoggerFactory.getLogger(JaxbUtilTest.class);
test_class.type: Logger
test_class.var_name: log
test_class.file: commons/components/commons-mule/src/test/java/org/soitoolkit/commons/mule/jaxb/JaxbUtilTest.java
test_class.identifier: JaxbUtilTest
test_case.body: @Test
  	public void testUnmarshal() {
  		
  		String expectedPayload = "MyPayload"; 
  		
  		String xml = 
  		"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
  		"<logEvent xmlns=\"urn:org.soitoolkit.commons.logentry.schema:v1\">" + 
  		"<logEntry>" +
  		"<payload>MyPayload</payload>" +
  		"</logEntry>" +
  		"</logEvent>";
  		
  		JaxbUtil jaxbUtil = new JaxbUtil(LogEvent.class);
  		LogEvent logEvent = (LogEvent)jaxbUtil.unmarshal(xml);
  
  		String actualPayload = logEvent.getLogEntry().getPayload();
  				
  		log.info(actualPayload);
  		assertEquals(expectedPayload, actualPayload);
  	}
test_case.class_method_signature: JaxbUtilTest.testUnmarshal()
test_case.full_signature: @Test public void testUnmarshal()
test_case.identifier: testUnmarshal
test_case.invocations: unmarshal getPayload getLogEntry info assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testUnmarshal()
focal_class.declarator: jaxbContext = null
focal_class.modifier: private
focal_class.original_string: private JAXBContext jaxbContext = null;
focal_class.type: JAXBContext
focal_class.var_name: jaxbContext
focal_class.declarator: logger = LoggerFactory.getLogger(getClass())
focal_class.modifier: private final
focal_class.original_string: private final Logger logger = LoggerFactory.getLogger(getClass());
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: unmarshallProps = null
focal_class.modifier: private
focal_class.original_string: private Map<String, Object> unmarshallProps = null;
focal_class.type: Map<String, Object>
focal_class.var_name: unmarshallProps
focal_class.declarator: marshallProps = null
focal_class.modifier: private
focal_class.original_string: private Map<String, Object> marshallProps = null;
focal_class.type: Map<String, Object>
focal_class.var_name: marshallProps
focal_class.file: commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/jaxb/JaxbUtil.java
focal_class.identifier: JaxbUtil
focal_class.class_method_signature: JaxbUtil.JaxbUtil(Class... classesToBeBound)
focal_class.full_signature: @SuppressWarnings("rawtypes") public  JaxbUtil(Class... classesToBeBound)
focal_class.identifier: JaxbUtil
focal_class.modifiers: @SuppressWarnings("rawtypes") public
focal_class.parameters: (Class... classesToBeBound)
focal_class.signature:  JaxbUtil(Class... classesToBeBound)
focal_class.class_method_signature: JaxbUtil.JaxbUtil(String contextPath)
focal_class.full_signature: public  JaxbUtil(String contextPath)
focal_class.identifier: JaxbUtil
focal_class.modifiers: public
focal_class.parameters: (String contextPath)
focal_class.signature:  JaxbUtil(String contextPath)
focal_class.class_method_signature: JaxbUtil.getContext()
focal_class.full_signature: public JAXBContext getContext()
focal_class.identifier: getContext
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: JAXBContext
focal_class.signature: JAXBContext getContext()
focal_class.class_method_signature: JaxbUtil.setContextPath(String contextPath)
focal_class.full_signature: public void setContextPath(String contextPath)
focal_class.identifier: setContextPath
focal_class.modifiers: public
focal_class.parameters: (String contextPath)
focal_class.return: void
focal_class.signature: void setContextPath(String contextPath)
focal_class.class_method_signature: JaxbUtil.addMarshallProperty(String name, Object value)
focal_class.full_signature: public void addMarshallProperty(String name, Object value)
focal_class.identifier: addMarshallProperty
focal_class.modifiers: public
focal_class.parameters: (String name, Object value)
focal_class.return: void
focal_class.signature: void addMarshallProperty(String name, Object value)
focal_class.class_method_signature: JaxbUtil.addUnmarshallProperty(String name, Object value)
focal_class.full_signature: public void addUnmarshallProperty(String name, Object value)
focal_class.identifier: addUnmarshallProperty
focal_class.modifiers: public
focal_class.parameters: (String name, Object value)
focal_class.return: void
focal_class.signature: void addUnmarshallProperty(String name, Object value)
focal_class.class_method_signature: JaxbUtil.marshal(Object jaxbObject)
focal_class.full_signature: public String marshal(Object jaxbObject)
focal_class.identifier: marshal
focal_class.modifiers: public
focal_class.parameters: (Object jaxbObject)
focal_class.return: String
focal_class.signature: String marshal(Object jaxbObject)
focal_class.class_method_signature: JaxbUtil.marshal(Object jaxbObject, String namespaceURI, String localPart)
focal_class.full_signature: @SuppressWarnings({ "unchecked", "rawtypes" }) public String marshal(Object jaxbObject, String namespaceURI, String localPart)
focal_class.identifier: marshal
focal_class.modifiers: @SuppressWarnings({ "unchecked", "rawtypes" }) public
focal_class.parameters: (Object jaxbObject, String namespaceURI, String localPart)
focal_class.return: String
focal_class.signature: String marshal(Object jaxbObject, String namespaceURI, String localPart)
focal_class.class_method_signature: JaxbUtil.unmarshal(Object payload)
focal_class.full_signature: @SuppressWarnings("rawtypes") public Object unmarshal(Object payload)
focal_class.identifier: unmarshal
focal_class.modifiers: @SuppressWarnings("rawtypes") public
focal_class.parameters: (Object payload)
focal_class.return: Object
focal_class.signature: Object unmarshal(Object payload)
focal_method.body: @SuppressWarnings("rawtypes")
  	public Object unmarshal(Object payload) {
  
  		// Precondition, check that the jaxbContext is set!
      	if (jaxbContext == null) {
      		logger.error("Trying to unmarshal with a null jaxbContext, returns null. Check your configuration, e.g. jaxb-transformers!");
      		return null;
      	}
  
      	try {
          	Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
          	if (unmarshallProps != null) {
  	        	for (Entry<String, Object> entry : unmarshallProps.entrySet()) {
  	        		unmarshaller.setProperty(entry.getKey(), entry.getValue());
  				}
          	}
              Object jaxbObject = null;
             
              // Unmarshal depending on the type of source
              if (payload instanceof String) {
          		String src = (String)payload;
          		jaxbObject = unmarshaller.unmarshal(new StringReader(src));
  
          	} else if (payload instanceof byte[]) {
          		byte[] src = (byte[])payload;
          		jaxbObject = unmarshaller.unmarshal(new ByteArrayInputStream(src));
          		
          	// Rely on standard JAXB unmarshaller
          	} else if (payload instanceof File) {
          		jaxbObject = unmarshaller.unmarshal((File)payload);
          		
          	} else if (payload instanceof InputSource) {
          		jaxbObject = unmarshaller.unmarshal((InputSource)payload);
          		
          	} else if (payload instanceof InputStream) {
          		jaxbObject = unmarshaller.unmarshal((InputStream)payload);
          		
          	} else if (payload instanceof Reader) {
          		jaxbObject = unmarshaller.unmarshal((Reader)payload);
  
          	} else if (payload instanceof URL) {
          		jaxbObject = unmarshaller.unmarshal((URL)payload);
          		
          	} else if (payload instanceof InputSource) {
          		jaxbObject = unmarshaller.unmarshal((InputSource)payload);
          		
          	} else if (payload instanceof Node) {
          		jaxbObject = unmarshaller.unmarshal((Node)payload);
  
          	} else if (payload instanceof Source) {
          		jaxbObject = unmarshaller.unmarshal((Source)payload);
          		
          	} else if (payload instanceof XMLEventReader) {
          		jaxbObject = unmarshaller.unmarshal((XMLEventReader)payload);
          		
          	} else if (payload instanceof XMLStreamReader) {
          		jaxbObject = unmarshaller.unmarshal((XMLStreamReader)payload);
  
          	} else {
          		// Out of alternatives, have to throw a unknown source type exception...
          		throw new RuntimeException("Unknown sourcetype of the xml payload: " + payload.getClass().getName());
          	}
          		
              // Unmarshal done, postprocess by replacing any JAXBElement with the actual jaxb-object, see comment in the class-doc.
              if (jaxbObject instanceof JAXBElement) {
                  if (logger.isDebugEnabled()) logger.debug("Found a JAXBElement, returns it value");
                  jaxbObject = ((JAXBElement)jaxbObject).getValue();
              }
  
              logger.debug("unmarshalled xml payload of type: {}, returns jaxb object of type {}", payload.getClass().getName(), jaxbObject.getClass().getName());
  
              return jaxbObject;
          }
          catch (JAXBException e) {
              throw new RuntimeException(e);
          }
      }
focal_method.class_method_signature: JaxbUtil.unmarshal(Object payload)
focal_method.full_signature: @SuppressWarnings("rawtypes") public Object unmarshal(Object payload)
focal_method.identifier: unmarshal
focal_method.invocations: error createUnmarshaller entrySet setProperty getKey getValue unmarshal unmarshal unmarshal unmarshal unmarshal unmarshal unmarshal unmarshal unmarshal unmarshal unmarshal unmarshal getName getClass isDebugEnabled debug getValue debug getName getClass getName getClass
focal_method.modifiers: @SuppressWarnings("rawtypes") public
focal_method.parameters: (Object payload)
focal_method.return: Object
focal_method.signature: Object unmarshal(Object payload)