Example usage for org.springframework.batch.item.xml StaxEventItemWriter StaxEventItemWriter

List of usage examples for org.springframework.batch.item.xml StaxEventItemWriter StaxEventItemWriter

Introduction

In this page you can find the example usage for org.springframework.batch.item.xml StaxEventItemWriter StaxEventItemWriter.

Prototype

public StaxEventItemWriter() 

Source Link

Usage

From source file:org.springframework.batch.item.xml.StaxEventItemWriterTests.java

@Test(expected = WriterNotOpenException.class)
public void testAssertWriterIsInitialized() throws Exception {
    StaxEventItemWriter writer = new StaxEventItemWriter();

    writer.write(Collections.singletonList("foo"));
}

From source file:org.springframework.batch.item.xml.StaxEventItemWriterTests.java

/**
 * @return new instance of fully configured writer
 *///from w w  w . ja  va 2  s . c  o  m
private StaxEventItemWriter<Object> createItemWriter() throws Exception {
    StaxEventItemWriter<Object> source = new StaxEventItemWriter<Object>();
    source.setResource(resource);

    marshaller = new SimpleMarshaller();
    source.setMarshaller(marshaller);

    source.setEncoding("UTF-8");
    source.setRootTagName("root");
    source.setVersion("1.0");
    source.setOverwriteOutput(true);
    source.setSaveState(true);

    source.afterPropertiesSet();

    return source;
}

From source file:org.springframework.batch.item.xml.TransactionalStaxEventItemWriterTests.java

/**
 * @return new instance of fully configured writer
 *///from  www. ja v  a2s.c o  m
private StaxEventItemWriter<Object> createItemWriter() throws Exception {
    StaxEventItemWriter<Object> source = new StaxEventItemWriter<Object>();
    source.setResource(resource);

    Marshaller marshaller = new SimpleMarshaller();
    source.setMarshaller(marshaller);

    source.setEncoding("UTF-8");
    source.setRootTagName("root");
    source.setVersion("1.0");
    source.setOverwriteOutput(true);
    source.setSaveState(true);

    source.afterPropertiesSet();

    return source;
}