EMMA Coverage Report (generated Fri Jan 30 13:20:29 EST 2009)
[all classes][org.springframework.batch.item.xml.oxm]

COVERAGE SUMMARY FOR SOURCE FILE [MarshallingEventWriterSerializer.java]

nameclass, %method, %block, %line, %
MarshallingEventWriterSerializer.java100% (1/1)100% (2/2)100% (35/35)100% (9/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MarshallingEventWriterSerializer100% (1/1)100% (2/2)100% (35/35)100% (9/9)
MarshallingEventWriterSerializer (Marshaller): void 100% (1/1)100% (6/6)100% (3/3)
serializeObject (XMLEventWriter, Object): void 100% (1/1)100% (29/29)100% (6/6)

1package org.springframework.batch.item.xml.oxm;
2 
3import java.io.IOException;
4 
5import javax.xml.stream.XMLEventWriter;
6import javax.xml.transform.Result;
7 
8import org.springframework.batch.item.xml.EventWriterSerializer;
9import org.springframework.dao.DataAccessResourceFailureException;
10import org.springframework.oxm.Marshaller;
11import org.springframework.xml.transform.StaxResult;
12 
13/**
14 * Object to xml serializer that wraps a Spring OXM {@link Marshaller} object.
15 * 
16 * @author Lucas Ward
17 * 
18 */
19public class MarshallingEventWriterSerializer implements EventWriterSerializer {
20 
21        private Marshaller marshaller;
22 
23        public MarshallingEventWriterSerializer(Marshaller marshaller) {
24                this.marshaller = marshaller;
25        }
26 
27        public void serializeObject(XMLEventWriter writer, Object output) {
28                Result result = new StaxResult(writer);
29                try {
30                        marshaller.marshal(output, result);
31                }
32                catch (IOException xse) {
33                        throw new DataAccessResourceFailureException("Unable to write to file resource: [" + result.getSystemId()
34                                        + "]", xse);
35                }
36        }
37}

[all classes][org.springframework.batch.item.xml.oxm]
EMMA 2.0.5312 (C) Vladimir Roubtsov