Coverage Report - org.apache.xmlrpc.jaxb.JaxbParser
 
Classes in this File Line Coverage Branch Coverage Complexity
JaxbParser
0% 
N/A 
2,25
 
 1  
 package org.apache.xmlrpc.jaxb;
 2  
 
 3  
 import javax.xml.bind.JAXBContext;
 4  
 import javax.xml.bind.JAXBException;
 5  
 import javax.xml.bind.UnmarshallerHandler;
 6  
 
 7  
 import org.apache.xmlrpc.XmlRpcException;
 8  
 import org.apache.xmlrpc.parser.ExtParser;
 9  
 import org.xml.sax.ContentHandler;
 10  
 import org.xml.sax.SAXException;
 11  
 
 12  
 
 13  
 /** A parser for JAXB objects.
 14  
  */
 15  
 public class JaxbParser extends ExtParser {
 16  
         private final JAXBContext context;
 17  
         private UnmarshallerHandler handler;
 18  
 
 19  
         /** Creates a new instance with the given context.
 20  
          * @param pContext The context being used for creating unmarshallers.
 21  
          */
 22  0
         public JaxbParser(JAXBContext pContext) {
 23  0
                 context = pContext;
 24  0
         }
 25  
 
 26  
         protected ContentHandler getExtHandler() throws SAXException {
 27  
                 try {
 28  0
                         handler = context.createUnmarshaller().getUnmarshallerHandler();
 29  0
                 } catch (JAXBException e) {
 30  0
                         throw new SAXException(e);
 31  
                 }
 32  0
                 return handler;
 33  
         }
 34  
 
 35  0
         protected String getTagName() { return JaxbSerializer.JAXB_TAG; }
 36  
 
 37  
         public Object getResult() throws XmlRpcException {
 38  
                 try {
 39  0
                         return handler.getResult();
 40  0
                 } catch (JAXBException e) {
 41  0
                         throw new XmlRpcException("Failed to create result object: " + e.getMessage(), e);
 42  
                 }
 43  
         }
 44  
 }