Class StaxEventItemWriterBuilder<T>
java.lang.Object
org.springframework.batch.item.xml.builder.StaxEventItemWriterBuilder<T>
A builder for the
StaxEventItemWriter
.- Since:
- 4.0
- Author:
- Michael Minella, Parikshit Dutta, Mahmoud Ben Hassine
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns a configuredStaxEventItemWriter
Encoding for the file.footerCallback
(StaxWriterCallback footerCallback) AStaxWriterCallback
to provide any footer elementsforceSync
(boolean forceSync) Flag to indicate that changes should be force-synced to disk on flush.headerCallback
(StaxWriterCallback headerCallback) AStaxWriterCallback
to provide any header elementsmarshaller
(org.springframework.oxm.Marshaller marshaller) TheMarshaller
implementation responsible for the serialization of the items to XML.The name used to calculate the key within theExecutionContext
.overwriteOutput
(boolean overwriteOutput) Indicates if an existing file should be overwritten if found.resource
(org.springframework.core.io.WritableResource resource) TheWritableResource
to be used as output.rootElementAttributes
(Map<String, String> rootElementAttributes) A Map of attributes to be included in the document's root element.rootTagName
(String rootTagName) The name of the root tag for the output document.saveState
(boolean saveState) Indicates if the state of the writer should be saved in theExecutionContext
.shouldDeleteIfEmpty
(boolean shouldDelete) Flag to indicate that the output file should be deleted if no results were written to it.standalone
(Boolean standalone) Standalone document declaration for the output document.transactional
(boolean transactional) The resulting writer is participating in a transaction and writes should be delayed as late as possible.Version of XML to be generated.
-
Constructor Details
-
StaxEventItemWriterBuilder
public StaxEventItemWriterBuilder()
-
-
Method Details
-
name
The name used to calculate the key within theExecutionContext
. Required ifsaveState(boolean)
is set to true.- Parameters:
name
- name of the reader instance- Returns:
- The current instance of the builder.
- See Also:
-
resource
public StaxEventItemWriterBuilder<T> resource(org.springframework.core.io.WritableResource resource) TheWritableResource
to be used as output.- Parameters:
resource
- the output from the writer- Returns:
- the current instance of the builder.
- See Also:
-
marshaller
TheMarshaller
implementation responsible for the serialization of the items to XML. This field is required.- Parameters:
marshaller
- the component used to generate XML- Returns:
- the current instance of the builder.
- See Also:
-
headerCallback
AStaxWriterCallback
to provide any header elements- Parameters:
headerCallback
- aStaxWriterCallback
- Returns:
- the current instance of the builder.
- See Also:
-
transactional
The resulting writer is participating in a transaction and writes should be delayed as late as possible.- Parameters:
transactional
- indicates that the writer is transactional. Defaults to false.- Returns:
- the current instance of the builder
- See Also:
-
forceSync
Flag to indicate that changes should be force-synced to disk on flush.- Parameters:
forceSync
- indicates if force sync should occur. Defaults to false.- Returns:
- the current instance of the builder
- See Also:
-
shouldDeleteIfEmpty
Flag to indicate that the output file should be deleted if no results were written to it. Defaults to false.- Parameters:
shouldDelete
- indicator- Returns:
- the current instance of the builder
- See Also:
-
encoding
Encoding for the file. Defaults to UTF-8.- Parameters:
encoding
- String encoding algorithm- Returns:
- the current instance of the builder
- See Also:
-
version
Version of XML to be generated. Must be supported by theMarshaller
provided.- Parameters:
version
- XML version- Returns:
- the current instance of the builder
- See Also:
-
standalone
Standalone document declaration for the output document. Defaults tonull
.- Parameters:
standalone
- Boolean standalone document declaration- Returns:
- the current instance of the builder
- Since:
- 4.3
- See Also:
-
rootTagName
The name of the root tag for the output document.- Parameters:
rootTagName
- tag name- Returns:
- the current instance of the builder
- See Also:
-
rootElementAttributes
public StaxEventItemWriterBuilder<T> rootElementAttributes(Map<String, String> rootElementAttributes) A Map of attributes to be included in the document's root element.- Parameters:
rootElementAttributes
- map fo attributes- Returns:
- the current instance of the builder.
- See Also:
-
overwriteOutput
Indicates if an existing file should be overwritten if found. Defaults to true.- Parameters:
overwriteOutput
- indicator- Returns:
- the current instance of the builder.
- See Also:
-
saveState
Indicates if the state of the writer should be saved in theExecutionContext
. Setting this to false will impact restartability. Defaults to true.- Parameters:
saveState
- indicator- Returns:
- the current instance of the builder
- See Also:
-
build
Returns a configuredStaxEventItemWriter
- Returns:
- a StaxEventItemWriter
-